summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-list-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-05-16 16:02:24 +0000
committernicm <nicm@openbsd.org>2020-05-16 16:02:24 +0000
commit67c16a7c4d17d310924af977dee76cce5e60baf4 (patch)
tree5687d51b44d9a5502e6440cf31fcf9922f470f95 /usr.bin/tmux/cmd-list-keys.c
parentSupport embedded styles in the display-message message, GitHub issue (diff)
downloadwireguard-openbsd-67c16a7c4d17d310924af977dee76cce5e60baf4.tar.xz
wireguard-openbsd-67c16a7c4d17d310924af977dee76cce5e60baf4.zip
Add a customize mode where keys and options may be browsed and changed,
includes adding a brief description of each option. Bound to "C" by default.
Diffstat (limited to 'usr.bin/tmux/cmd-list-keys.c')
-rw-r--r--usr.bin/tmux/cmd-list-keys.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c
index d61d8c682fc..361ce6de6ed 100644
--- a/usr.bin/tmux/cmd-list-keys.c
+++ b/usr.bin/tmux/cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-keys.c,v 1.57 2020/05/16 15:54:20 nicm Exp $ */
+/* $OpenBSD: cmd-list-keys.c,v 1.58 2020/05/16 16:02:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -68,7 +68,8 @@ cmd_list_keys_get_width(const char *tablename, key_code only)
while (bd != NULL) {
if ((only != KEYC_UNKNOWN && bd->key != only) ||
KEYC_IS_MOUSE(bd->key) ||
- bd->note == NULL) {
+ bd->note == NULL ||
+ *bd->note == '\0') {
bd = key_bindings_next(table, bd);
continue;
}
@@ -99,14 +100,15 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
while (bd != NULL) {
if ((only != KEYC_UNKNOWN && bd->key != only) ||
KEYC_IS_MOUSE(bd->key) ||
- (bd->note == NULL && !args_has(args, 'a'))) {
+ ((bd->note == NULL || *bd->note == '\0') &&
+ !args_has(args, 'a'))) {
bd = key_bindings_next(table, bd);
continue;
}
found = 1;
key = key_string_lookup_key(bd->key);
- if (bd->note == NULL)
+ if (bd->note == NULL || *bd->note == '\0')
note = cmd_list_print(bd->cmdlist, 1);
else
note = xstrdup(bd->note);