diff options
author | Daniel Carl <danielcarl@gmx.de> | 2014-08-15 23:24:12 +0200 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2014-08-15 23:24:12 +0200 |
commit | 48ded2300d81da56425a2ab18626949da4f77841 (patch) | |
tree | 94a3950e48c1daa04e8e97f9334278dfe252fb1c /src/input.c | |
parent | 18dae1483076565151a4cd1c54e57387fa4e257d (diff) |
Added CTRL-0 to run normal mode command during input mode.
Diffstat (limited to 'src/input.c')
-rw-r--r-- | src/input.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c index b34b423..5da62e8 100644 --- a/src/input.c +++ b/src/input.c @@ -25,6 +25,7 @@ #include "dom.h" #include "util.h" #include "ascii.h" +#include "normal.h" typedef struct { char *file; @@ -59,11 +60,31 @@ void input_leave(void) */ VbResult input_keypress(int key) { + static gboolean ctrlo = false; + + if (ctrlo) { + /* if we are in ctrl-O mode perform the next keys as normal mode + * commands until the command is complete or error */ + VbResult res = normal_keypress(key); + if (res != RESULT_MORE) { + ctrlo = false; + vb_echo(VB_MSG_NORMAL, false, "-- INPUT --"); + } + return res; + } + switch (key) { case CTRL('['): /* esc */ mode_enter('n'); return RESULT_COMPLETE; + case CTRL('O'): + /* enter CTRL-0 mode to execute next command in normal mode */ + ctrlo = true; + vb.mode->flags |= FLAG_NOMAP; + vb_echo(VB_MSG_NORMAL, false, "-- (input) --"); + return RESULT_MORE; + case CTRL('T'): return input_open_editor(); @@ -71,6 +92,7 @@ VbResult input_keypress(int key) mode_enter('p'); return RESULT_COMPLETE; } + vb.state.processed_key = false; return RESULT_ERROR; } |