This commit is contained in:
Přemysl Eric Janouch 2017-06-27 04:35:02 +02:00
parent a1831a3ab8
commit 0f350f88b3
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 8 additions and 10 deletions

View File

@ -3032,8 +3032,8 @@ info_tab_init (void)
static struct strv g_help_tab_lines; static struct strv g_help_tab_lines;
static size_t static void
help_tab_strfkey (const termo_key_t *key, char *buf, size_t len) help_tab_strfkey (const termo_key_t *key, struct strv *out)
{ {
// For display purposes, this is highly desirable // For display purposes, this is highly desirable
int flags = termo_get_flags (g.tk); int flags = termo_get_flags (g.tk);
@ -3041,23 +3041,21 @@ help_tab_strfkey (const termo_key_t *key, char *buf, size_t len)
termo_key_t fixed = *key; termo_key_t fixed = *key;
termo_canonicalise (g.tk, &fixed); termo_canonicalise (g.tk, &fixed);
termo_set_flags (g.tk, flags); termo_set_flags (g.tk, flags);
return termo_strfkey_utf8 (g.tk, buf, len, &fixed, TERMO_FORMAT_ALTISMETA);
char buf[16];
termo_strfkey_utf8 (g.tk, buf, sizeof buf, &fixed, TERMO_FORMAT_ALTISMETA);
strv_append (out, buf);
} }
static void static void
help_tab_group (struct binding *keys, size_t len, struct strv *out) help_tab_group (struct binding *keys, size_t len, struct strv *out)
{ {
char buf[16];
for (enum action i = 0; i < ACTION_COUNT; i++) for (enum action i = 0; i < ACTION_COUNT; i++)
{ {
struct strv ass = strv_make (); struct strv ass = strv_make ();
for (size_t k = 0; k < len; k++) for (size_t k = 0; k < len; k++)
{ if (keys[k].action == i)
if (keys[k].action != i) help_tab_strfkey (&keys[k].decoded, &ass);
continue;
help_tab_strfkey (&keys[k].decoded, buf, sizeof buf);
strv_append (&ass, buf);
}
if (ass.len) if (ass.len)
{ {
char *joined = strv_join (&ass, ", "); char *joined = strv_join (&ass, ", ");