aboutsummaryrefslogtreecommitdiffhomepage
path: root/input.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-10-09 11:15:29 +1000
committerGravatar axel <axel@liljencrantz.se>2006-10-09 11:15:29 +1000
commit7a8b46816556339059878cf62dbe142552de953a (patch)
tree7df742503172a5ff07db95980faf59042262497c /input.c
parent770fa771b6985c1ae38fe47c25e8d8c3061a0dfa (diff)
Allow Meta-newline to always insert a newline character
darcs-hash:20061009011529-ac50b-c8e3d77b569bc445e586c95aca01e4433fbff598.gz
Diffstat (limited to 'input.c')
-rw-r--r--input.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/input.c b/input.c
index 833e7808..406e4b2e 100644
--- a/input.c
+++ b/input.c
@@ -130,7 +130,8 @@ static const wchar_t *name_arr[] =
L"self-insert",
L"null",
L"eof",
- L"vi-arg-digit"
+ L"vi-arg-digit",
+ L"execute"
}
;
@@ -207,7 +208,8 @@ static const wchar_t code_arr[] =
R_SELF_INSERT,
R_NULL,
R_EOF,
- R_VI_ARG_DIGIT
+ R_VI_ARG_DIGIT,
+ R_EXECUTE
}
;
@@ -1222,6 +1224,14 @@ static void add_common_bindings()
*/
for( i=0; i<3; i++ )
{
+ add_mapping( name[i], L"\n", L"Execute contents of commandline", L"execute" );
+
+ /*
+ This will make Meta-newline insert a newline, since
+ self-insert ignored the escape character unless it is the
+ only character of the sequence.
+ */
+ add_mapping( name[i], L"\e\n", L"Meta-newline", L"self-insert" );
/*
We need alternative keybidnings for arrowkeys, since
terminfo sometimes specifies a different sequence than what
@@ -1509,6 +1519,7 @@ static wint_t input_exec_binding( mapping *m, const wchar_t *seq )
{
switch( code )
{
+
case R_DUMP_FUNCTIONS:
{
for( i=0; i<repeat_count; i++ )
@@ -1519,10 +1530,17 @@ static wint_t input_exec_binding( mapping *m, const wchar_t *seq )
case R_SELF_INSERT:
{
+ int idx = 0;
+
+ if( seq[0] == L'\e' && seq[1] )
+ {
+ idx = 1;
+ }
+
for( i=1; i<repeat_count; i++ )
- input_unreadch( seq[0] );
+ input_unreadch( seq[idx] );
repeat_count = 1;
- return seq[0];
+ return seq[idx];
}
case R_VI_ARG_DIGIT: