diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-01-14 21:53:41 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-01-14 21:53:41 +0000 |
commit | bbbf4bef8ac88f47484f0c3c1373e6cd2694594b (patch) | |
tree | b196fa4ec088112afe3982d98128011a01c9de76 | |
parent | ba89a44ca53037b6cde75ba03270161dd0e3aa37 (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).
-rw-r--r-- | usr.bin/tmux/key-string.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 59760a1df1a..b34477f5193 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.12 2009/12/03 22:50:10 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.13 2010/01/14 21:53:40 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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)); } |