summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authornicm <nicm>2019-11-14 07:55:01 +0000
committernicm <nicm>2019-11-14 07:55:01 +0000
commit08b07b1a08ad02f7a195437deead0a60f971e1ee (patch)
tree008cb66149cd8540af544c6f73d4094d096dc18b /key-string.c
parentc225262e132ded1b4e1e8c0bd21884e9da78ddb3 (diff)
Add an option to set the key sent by backspace for those whose system
uses ^H rather than ^?. GitHub issue 1969.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/key-string.c b/key-string.c
index a1ef4f51..0505623e 100644
--- a/key-string.c
+++ b/key-string.c
@@ -159,7 +159,7 @@ key_string_get_modifiers(const char **string)
key_code
key_string_lookup_string(const char *string)
{
- static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
+ static const char *other = "!#()+,-.0123456789:;<=>'\r\t";
key_code key;
u_int u;
key_code modifiers;
@@ -196,7 +196,7 @@ key_string_lookup_string(const char *string)
/* Is this a standard ASCII key? */
if (string[1] == '\0' && (u_char)string[0] <= 127) {
key = (u_char)string[0];
- if (key < 32 || key == 127)
+ if (key < 32)
return (KEYC_UNKNOWN);
} else {
/* Try as a UTF-8 key. */
@@ -226,6 +226,8 @@ key_string_lookup_string(const char *string)
key -= 64;
else if (key == 32)
key = 0;
+ else if (key == '?')
+ key = 127;
else if (key == 63)
key = KEYC_BSPACE;
else
@@ -329,7 +331,7 @@ key_string_lookup_key(key_code key)
}
/* Invalid keys are errors. */
- if (key == 127 || key > 255) {
+ if (key > 255) {
snprintf(out, sizeof out, "Invalid#%llx", key);
return (out);
}
@@ -343,7 +345,9 @@ key_string_lookup_key(key_code key)
} else if (key >= 32 && key <= 126) {
tmp[0] = key;
tmp[1] = '\0';
- } else if (key >= 128)
+ } else if (key == 127)
+ xsnprintf(tmp, sizeof tmp, "C-?");
+ else if (key >= 128)
xsnprintf(tmp, sizeof tmp, "\\%llo", key);
strlcat(out, tmp, sizeof out);