diff options
author | 2016-10-12 14:50:14 +0000 | |
---|---|---|
committer | 2016-10-12 14:50:14 +0000 | |
commit | ce3f476a9998545a4f10486560f8ebd4594ab525 (patch) | |
tree | c31ee3a1799f20bf30c14547dd3e4ebad141455a /usr.bin/tmux/cmd-list-keys.c | |
parent | client_identifier is not a string so using strlen() on it is (diff) | |
download | wireguard-openbsd-ce3f476a9998545a4f10486560f8ebd4594ab525.tar.xz wireguard-openbsd-ce3f476a9998545a4f10486560f8ebd4594ab525.zip |
Drop the edit mode key tables and just use fixed key bindings for the
command prompt.
Diffstat (limited to 'usr.bin/tmux/cmd-list-keys.c')
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index da6c4eb6518..7c618c7c81a 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.37 2016/10/11 07:23:34 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.38 2016/10/12 14:50:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -135,10 +135,10 @@ static enum cmd_retval cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - const char *tablename, *key, *cmdstr, *mode; + const char *tablename, *cmdstr; const struct mode_key_table *mtab; struct mode_key_binding *mbind; - int width, keywidth, any_mode; + int width, keywidth; tablename = args_get(args, 't'); if ((mtab = mode_key_findtable(tablename)) == NULL) { @@ -147,30 +147,18 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq) } keywidth = 0; - any_mode = 0; RB_FOREACH(mbind, mode_key_tree, mtab->tree) { - key = key_string_lookup_key(mbind->key); - - if (mbind->mode != 0) - any_mode = 1; - - width = strlen(key); + width = strlen(key_string_lookup_key(mbind->key)); if (width > keywidth) keywidth = width; } RB_FOREACH(mbind, mode_key_tree, mtab->tree) { - key = key_string_lookup_key(mbind->key); - - mode = ""; - if (mbind->mode != 0) - mode = "c"; cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd); if (cmdstr != NULL) { - cmdq_print(cmdq, "bind-key -%st %s%s %*s %s", - mode, any_mode && *mode == '\0' ? " " : "", - mtab->name, - (int)keywidth, key, cmdstr); + cmdq_print(cmdq, "bind-key -t %s %*s %s", + mtab->name, (int)keywidth, + key_string_lookup_key(mbind->key), cmdstr); } } |