mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Add j and k for navigation in menus, GitHub issue 1828.
This commit is contained in:
parent
a4be028b76
commit
b74b8be680
20
menu.c
20
menu.c
@ -206,8 +206,18 @@ menu_key_cb(struct client *c, struct key_event *event)
|
||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||
return (0);
|
||||
}
|
||||
for (i = 0; i < (u_int)count; i++) {
|
||||
name = menu->items[i].name;
|
||||
if (name == NULL || *name == '-')
|
||||
continue;
|
||||
if (event->key == menu->items[i].key) {
|
||||
md->choice = i;
|
||||
goto chosen;
|
||||
}
|
||||
}
|
||||
switch (event->key) {
|
||||
case KEYC_UP:
|
||||
case 'k':
|
||||
if (old == -1)
|
||||
old = 0;
|
||||
do {
|
||||
@ -220,6 +230,7 @@ menu_key_cb(struct client *c, struct key_event *event)
|
||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||
return (0);
|
||||
case KEYC_DOWN:
|
||||
case 'j':
|
||||
if (old == -1)
|
||||
old = 0;
|
||||
do {
|
||||
@ -239,15 +250,6 @@ menu_key_cb(struct client *c, struct key_event *event)
|
||||
case 'q':
|
||||
return (1);
|
||||
}
|
||||
for (i = 0; i < (u_int)count; i++) {
|
||||
name = menu->items[i].name;
|
||||
if (name == NULL || *name == '-')
|
||||
continue;
|
||||
if (event->key == menu->items[i].key) {
|
||||
md->choice = i;
|
||||
goto chosen;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
||||
chosen:
|
||||
|
Loading…
Reference in New Issue
Block a user