Merge pull request #273 from mohi001/main

add "g" and "G" to vim keys
This commit is contained in:
Jakob P. Liljenberg 2022-02-21 19:37:15 +01:00 committed by GitHub
commit d3a8421bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -595,7 +595,7 @@ force_tty = False
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l" keys for directional control in lists.
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = False

View File

@ -54,7 +54,7 @@ namespace Config {
"#* Use withespace \" \" as separator between different presets.\n"
"#* Example: \"cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty\""},
{"vim_keys", "#* Set to True to enable \"h,j,k,l\" keys for directional control in lists.\n"
{"vim_keys", "#* Set to True to enable \"h,j,k,l,g,G\" keys for directional control in lists.\n"
"#* Conflicting keys for h:\"help\" and k:\"kill\" is accessible while holding shift."},
{"rounded_corners", "#* Rounded corners on boxes, is ignored if TTY mode is ON."},

View File

@ -1070,11 +1070,11 @@ namespace Proc {
if (selected > 0 and start >= numpids - select_max) selected = select_max;
else start = clamp(start + select_max, 0, max(0, numpids - select_max));
}
else if (cmd_key == "home") {
else if (cmd_key == "home" or (vim_keys and cmd_key == "g")) {
start = 0;
if (selected > 0) selected = 1;
}
else if (cmd_key == "end") {
else if (cmd_key == "end" or (vim_keys and cmd_key == "G")) {
start = max(0, numpids - select_max);
if (selected > 0) selected = select_max;
}

View File

@ -416,7 +416,7 @@ namespace Input {
Menu::show(Menu::Menus::SignalChoose);
return;
}
else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end") or (vim_keys and is_in(key, "j", "k"))) {
else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end") or (vim_keys and is_in(key, "j", "k", "g", "G"))) {
proc_mouse_scroll:
redraw = false;
auto old_selected = Config::getI("proc_selected");