diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-10-05 10:48:03 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-10-26 10:52:01 -0300 |
commit | 32594a33a3d815b0da6634cb41692e412276cb91 (patch) | |
tree | 1495c7e46e1f8f87dd80e481b47f18c7337c5868 | |
parent | e5165bae1139221ef752bccd582c7bd7474e6747 (diff) | |
download | rneovim-32594a33a3d815b0da6634cb41692e412276cb91.tar.gz rneovim-32594a33a3d815b0da6634cb41692e412276cb91.tar.bz2 rneovim-32594a33a3d815b0da6634cb41692e412276cb91.zip |
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).
-rw-r--r-- | src/nvim/normal.c | 21 |
1 files changed, 15 insertions, 6 deletions
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; } |