diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-05-23 17:02:25 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-05-23 17:02:25 +0100 |
commit | 43431e7e8458091c762792db39af3fef65e14412 (patch) | |
tree | 9887dff5841a98b0f31e561bd663bbedce9f2c38 /cmd-list-keys.c | |
parent | 389cf63cbc027c995900bbdd6e68f4f5a96e5c08 (diff) | |
parent | eb8b51effcd2dee7b95c811c894bf29387a272c9 (diff) | |
download | rtmux-43431e7e8458091c762792db39af3fef65e14412.tar.gz rtmux-43431e7e8458091c762792db39af3fef65e14412.tar.bz2 rtmux-43431e7e8458091c762792db39af3fef65e14412.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-list-keys.c')
-rw-r--r-- | cmd-list-keys.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 5efb0cd2..57f65c8e 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -60,8 +60,8 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) struct args *args = self->args; struct key_table *table; struct key_binding *bd; - const char *key, *tablename, *r; - char *cp, tmp[BUFSIZ]; + const char *tablename, *r; + char *key, *cp, tmp[BUFSIZ]; int repeat, width, tablewidth, keywidth; if (self->entry == &cmd_list_commands_entry) @@ -83,7 +83,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) } bd = key_bindings_first(table); while (bd != NULL) { - key = key_string_lookup_key(bd->key); + key = args_escape(key_string_lookup_key(bd->key)); if (bd->flags & KEY_BINDING_REPEAT) repeat = 1; @@ -95,6 +95,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) if (width > keywidth) keywidth = width; + free(key); bd = key_bindings_next(table, bd); } table = key_bindings_next_table(table); @@ -108,7 +109,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) } bd = key_bindings_first(table); while (bd != NULL) { - key = key_string_lookup_key(bd->key); + key = args_escape(key_string_lookup_key(bd->key)); if (!repeat) r = ""; @@ -128,11 +129,13 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) strlcat(tmp, " ", sizeof tmp); free(cp); - cp = cmd_list_print(bd->cmdlist); + cp = cmd_list_print(bd->cmdlist, 1); strlcat(tmp, cp, sizeof tmp); free(cp); cmdq_print(item, "bind-key %s", tmp); + + free(key); bd = key_bindings_next(table, bd); } table = key_bindings_next_table(table); |