summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-22 10:30:04 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-22 10:30:04 +0000
commit306a3b8d8070146e22e26866390f9901fa1b7c4e (patch)
tree098293b1cbfd4f9ecbb2b084befe2f237e273b20
parent10682b9e7e4b38d6dcbf2f826737d7d2c7fbc0a0 (diff)
In terminals with XT, turn on modifyOtherKeys=1 with the escape sequence
and handle the most common set. Pass them through if xterm-keys is on.
-rw-r--r--key-string.c11
-rw-r--r--xterm-keys.c28
2 files changed, 34 insertions, 5 deletions
diff --git a/key-string.c b/key-string.c
index e06a71eb..7aba190b 100644
--- a/key-string.c
+++ b/key-string.c
@@ -136,9 +136,10 @@ key_string_get_modifiers(const char **string)
int
key_string_lookup_string(const char *string)
{
- int key, modifiers;
- u_short u;
- int size;
+ static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
+ int key, modifiers;
+ u_short u;
+ int size;
/* Is this a hexadecimal value? */
if (string[0] == '0' && string[1] == 'x') {
@@ -170,7 +171,7 @@ key_string_lookup_string(const char *string)
}
/* Convert the standard control keys. */
- if (key < KEYC_BASE && (modifiers & KEYC_CTRL)) {
+ if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && !strchr(other, key)) {
if (key >= 97 && key <= 122)
key -= 96;
else if (key >= 64 && key <= 95)
@@ -193,7 +194,7 @@ key_string_lookup_key(int key)
{
static char out[24];
char tmp[8];
- u_int i;
+ u_int i;
*out = '\0';
diff --git a/xterm-keys.c b/xterm-keys.c
index 1956c0b4..75eb6751 100644
--- a/xterm-keys.c
+++ b/xterm-keys.c
@@ -87,6 +87,34 @@ const struct xterm_keys_entry xterm_keys_table[] = {
{ KEYC_NPAGE, "\033[6;_~" },
{ KEYC_IC, "\033[2;_~" },
{ KEYC_DC, "\033[3;_~" },
+
+ { '!', "\033[27;_;33~" },
+ { '#', "\033[27;_;35~" },
+ { '(', "\033[27;_;40~" },
+ { ')', "\033[27;_;41~" },
+ { '+', "\033[27;_;43~" },
+ { ',', "\033[27;_;44~" },
+ { '-', "\033[27;_;45~" },
+ { '.', "\033[27;_;46~" },
+ { '0', "\033[27;_;48~" },
+ { '1', "\033[27;_;49~" },
+ { '2', "\033[27;_;50~" },
+ { '3', "\033[27;_;51~" },
+ { '4', "\033[27;_;52~" },
+ { '5', "\033[27;_;53~" },
+ { '6', "\033[27;_;54~" },
+ { '7', "\033[27;_;55~" },
+ { '8', "\033[27;_;56~" },
+ { '9', "\033[27;_;57~" },
+ { ':', "\033[27;_;58~" },
+ { ';', "\033[27;_;59~" },
+ { '<', "\033[27;_;60~" },
+ { '=', "\033[27;_;61~" },
+ { '>', "\033[27;_;62~" },
+ { '?', "\033[27;_;63~" },
+ { '\'', "\033[27;_;39~" },
+ { '\r', "\033[27;_;13~" },
+ { '\t', "\033[27;_;9~" },
};
/*