From 32594a33a3d815b0da6634cb41692e412276cb91 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 5 Oct 2015 10:48:03 -0300 Subject: main: Call `normal_execute` from `normal_enter` `normal_prepare` is now called by `normal_check` before returning 1(to continue). Also remove `input_{enable,disable}_events` calls from `normal_cmd`, which only exists now as a compatibility function to run normal commands with keys inserted into the typeahead buffer(We don't want to process events in these cases anyway). --- src/nvim/normal.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 740c30d323..1f2d6f9caf 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -463,7 +463,13 @@ void normal_enter(bool cmdwin, bool noexmode) } else if (check_result == -1) { continue; } - normal_cmd(&state.oa, true); + + input_enable_events(); + int c = safe_vgetc(); + input_disable_events(); + if (!normal_execute(&state, c)) { + break; + } } } @@ -1271,7 +1277,13 @@ static int normal_check(NormalState *s) return -1; } - return !s->cmdwin || cmdwin_result == 0; + if (s->cmdwin && cmdwin_result != 0) { + // command-line window and cmdwin_result is set + return 0; + } + + normal_prepare(s); + return 1; } /* @@ -7589,9 +7601,6 @@ void normal_cmd(oparg_T *oap, bool toplevel) s.toplevel = toplevel; s.oa = *oap; normal_prepare(&s); - input_enable_events(); - int c = safe_vgetc(); - input_disable_events(); - (void)normal_execute(&s, c); + (void)normal_execute(&s, safe_vgetc()); *oap = s.oa; } -- cgit