aboutsummaryrefslogtreecommitdiffhomepage
path: root/input.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-01-10 01:25:06 +1000
committerGravatar axel <axel@liljencrantz.se>2006-01-10 01:25:06 +1000
commit8ed80deb6bd362e5b584c9762c46ebd34b05b934 (patch)
tree0993f33011491ee54806c7da3095c8e88da28757 /input.c
parentb7c551a34897d7d262cf9fc1c004c87e46d05eb6 (diff)
More robust parsing of keybindings, allow sequences like \C-\ew and \C-?
darcs-hash:20060109152506-ac50b-0b040ba0aed86bf7f0b4a935f7842eccf1b45181.gz
Diffstat (limited to 'input.c')
-rw-r--r--input.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/input.c b/input.c
index 6ca5df1a..ff11dc4b 100644
--- a/input.c
+++ b/input.c
@@ -674,6 +674,8 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
*/
case L'C':
{
+ int has_escape = 0;
+
in++;
/* Make sure next key is a dash*/
if( *in != L'-' )
@@ -683,17 +685,29 @@ static wchar_t *input_expand_sequence( const wchar_t *in )
break;
}
in++;
+
+ if( (*in == L'\\') && (*(in+1)==L'e') )
+ {
+ has_escape = 1;
+ in += 2;
+
+ }
+
if( (*in >= L'a') &&
- (*in <= L'z') )
+ (*in < L'a'+32) )
{
+ if( has_escape )
+ *(out++)=L'\e';
*(out++)=*in-L'a'+1;
break;
}
if( (*in >= L'A') &&
- (*in <= L'Z') )
+ (*in < L'A'+32) )
{
+ if( has_escape )
+ *(out++)=L'\e';
*(out++)=*in-L'A'+1;
break;
}