summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-01-14 21:53:40 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-01-14 21:53:40 +0000
commitd5d0a36f66fd1b537830268b0d94cb7eb16d93ea (patch)
tree5ba77dcf86b1a9428cd6e124745d82ebcade5eb7 /key-string.c
parent8f301ed62d2cdd25e9bf8f731d9aabb7e028be48 (diff)
Permit S- prefix on keys for shift. Relatively few terminals support this
(basically xterm only) and even fewer have them in terminfo (kLFT2 and kRIT2).
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/key-string.c b/key-string.c
index 37b4928f..5c01d062 100644
--- a/key-string.c
+++ b/key-string.c
@@ -170,6 +170,25 @@ key_string_lookup_string(const char *string)
return (KEYC_NONE);
}
+ if ((string[0] == 'S' || string[0] == 's') && string[1] == '-') {
+ ptr = string + 2;
+ if (ptr[0] == '\0')
+ return (KEYC_NONE);
+ key = key_string_lookup_string(ptr);
+ if (key != KEYC_NONE) {
+ if (key >= KEYC_BASE)
+ return (key | KEYC_SHIFT);
+ } else {
+ if (ptr[1] == '\0')
+ return (KEYC_NONE);
+ key = (u_char) ptr[0];
+ }
+
+ if (key >= 32 && key <= 127)
+ return (key | KEYC_SHIFT);
+ return (KEYC_NONE);
+ }
+
return (key_string_search_table(string));
}