Hi Nick, this morning I set up a debug session and have found the problem:
in a recent commit the code to add the modifier keys was moved to the top,
but the "special case handling" for C-@ has to be moved as well.
I have attached a patch which solves the issue. Please have a look and
comment, thanks!
On Friday, March 13, 2020 at 11:31:04 PM UTC-7, topcat wrote:
>
> Hi, in the latest build from today, the key name for any binding for
> Ctrl-Space is shown as "Invalid#4000..." in the output from list-keys. I
> tested this without a config file.
> For example, the default binding for C-Space for copy-mode which starts a
> selection shows this error. I tried an older build from last week which I'm
> running on another machine and that did not have this issue. The binding
> itself works fine.
>
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/92765243-5f2a-4b6d-a395-146f87f74cde%40googlegroups.com.
diff --git a/key-string.c b/key-string.c
index d2b31e03..ab3d043e 100644
--- a/key-string.c
+++ b/key-string.c
@@ -257,6 +257,15 @@ 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);
+
/* Fill in the modifiers. */
if (key & KEYC_CTRL)
strlcat(out, "C-", sizeof out);
@@ -329,15 +338,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)