aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-10-05 10:48:03 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-10-26 10:52:01 -0300
commit32594a33a3d815b0da6634cb41692e412276cb91 (patch)
tree1495c7e46e1f8f87dd80e481b47f18c7337c5868
parente5165bae1139221ef752bccd582c7bd7474e6747 (diff)
downloadrneovim-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.c21
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;
}