summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-03-15 20:35:53 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-03-15 20:35:53 +0000
commit1c68d191b862e739879365f3ef69c11a7e98e626 (patch)
tree717b211a4fcc9ad5851d558a7eee076f457451e2 /usr.bin/tmux/key-string.c
parent4caaa706096dd353e3c2f5bc94e65ce1d51e3228 (diff)
Fix C-Space key string.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r--usr.bin/tmux/key-string.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c
index bba1708449a..99a29aba806 100644
--- a/usr.bin/tmux/key-string.c
+++ b/usr.bin/tmux/key-string.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-string.c,v 1.53 2020/02/19 14:25:00 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.54 2020/03/15 20:35:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -257,6 +257,10 @@ key_string_lookup_key(key_code key)
return (out);
}
+ /* Display C-@ as C-Space. */
+ if ((key & KEYC_MASK_KEY) == 0)
+ key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
+
/* Fill in the modifiers. */
if (key & KEYC_CTRL)
strlcat(out, "C-", sizeof out);
@@ -329,15 +333,6 @@ key_string_lookup_key(key_code key)
return (out);
}
- /*
- * Special case: display C-@ as C-Space. Could do this below in
- * the (key >= 0 && key <= 32), but this way we let it be found
- * in key_string_table, for the unlikely chance that we might
- * change its name.
- */
- if ((key & KEYC_MASK_KEY) == 0)
- key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD);
-
/* Try the key against the string table. */
for (i = 0; i < nitems(key_string_table); i++) {
if (key == key_string_table[i].key)