mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
Add command options for cursor mode and key 'press' input to listview driver
This commit is contained in:
parent
add3982d2e
commit
e7a4e388a2
@ -98,8 +98,12 @@ main(int argc, char* argv[])
|
||||
lv.set_window(win);
|
||||
noecho();
|
||||
|
||||
while ((c = getopt(argc, argv, "y:t:l:r:h:w")) != -1) {
|
||||
while ((c = getopt(argc, argv, "cy:t:k:l:r:h:w")) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
// Enable cursor mode
|
||||
lv.set_selectable(true);
|
||||
break;
|
||||
case 'y':
|
||||
lv.set_y(atoi(optarg));
|
||||
break;
|
||||
@ -107,6 +111,15 @@ main(int argc, char* argv[])
|
||||
lv.set_height(vis_line_t(atoi(optarg)));
|
||||
set_height = true;
|
||||
break;
|
||||
case 'k': {
|
||||
// Treats the string argument as sequence of key presses (only
|
||||
// individual characters supported as key input)
|
||||
for (char* ptr = optarg; ptr != nullptr && *ptr != '\0'; ++ptr)
|
||||
{
|
||||
lv.handle_key(static_cast<int>(*ptr));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
lv.set_top(vis_line_t(atoi(optarg)));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user