diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-07-09 12:44:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-07-09 12:44:48 +0000 |
commit | cabf604e683e5fe4bcd3c07517999ca04deff2e6 (patch) | |
tree | e36586af3a0a9b19d33a63f766f716fc0358b8fa /usr.bin | |
parent | def1f285c1a552de2fac89226dcdd2dfda0923de (diff) |
Add j and k for navigation in menus, GitHub issue 1828.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/menu.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c index 69b7b228825..0e4e1f83797 100644 --- a/usr.bin/tmux/menu.c +++ b/usr.bin/tmux/menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: menu.c,v 1.10 2019/06/18 11:08:42 nicm Exp $ */ +/* $OpenBSD: menu.c,v 1.11 2019/07/09 12:44:47 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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: |