diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-11-12 12:01:17 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-11-12 12:01:17 +0000 |
commit | 5f483499f3a7b98da9ac67cd62ed91034a5949ed (patch) | |
tree | de84187f104010233d96acc68bb9cc91d173c243 /cmd-list-keys.c | |
parent | 333da3b64b4ce8c0343f082c3923473205ab2b27 (diff) | |
parent | 0cc812ae342d1a71c0337db8ffb4d7701668cb38 (diff) | |
download | rtmux-5f483499f3a7b98da9ac67cd62ed91034a5949ed.tar.gz rtmux-5f483499f3a7b98da9ac67cd62ed91034a5949ed.tar.bz2 rtmux-5f483499f3a7b98da9ac67cd62ed91034a5949ed.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-list-keys.c')
-rw-r--r-- | cmd-list-keys.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c index d26486bd..c76f9f47 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -57,6 +57,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) char tmp[BUFSIZ]; size_t used; int repeat, width, tablewidth, keywidth; + u_int i; if (self->entry == &cmd_list_commands_entry) return (cmd_list_keys_commands(self, cmdq)); @@ -83,8 +84,8 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) width = strlen(table->name); if (width > tablewidth) - tablewidth =width; - width = strlen(key); + tablewidth = width; + width = utf8_cstrwidth(key); if (width > keywidth) keywidth = width; } @@ -102,8 +103,12 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) r = "-r "; else r = " "; - used = xsnprintf(tmp, sizeof tmp, "%s-T %-*s %-*s ", r, - (int)tablewidth, table->name, (int)keywidth, key); + used = xsnprintf(tmp, sizeof tmp, "%s-T %-*s %s", r, + (int)tablewidth, table->name, key); + for (i = 0; i < keywidth - utf8_cstrwidth(key); i++) { + if (strlcat(tmp, " ", sizeof tmp) < sizeof tmp) + used++; + } if (used < sizeof tmp) { cmd_list_print(bd->cmdlist, tmp + used, (sizeof tmp) - used); |