aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 5096f17df0..6864e2b914 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6866,6 +6866,9 @@ void post_chdir(CdScope scope)
curwin->w_localdir = vim_strsave(NameBuff);
}
break;
+ case kCdScopeInvalid:
+ // We should never get here
+ assert(false);
}
shorten_fnames(TRUE);
@@ -6993,7 +6996,7 @@ void do_sleep(long msec)
ui_flush(); // flush before waiting
for (long left = msec; !got_int && left > 0; left -= 1000L) {
int next = left > 1000l ? 1000 : (int)left;
- LOOP_PROCESS_EVENTS_UNTIL(&loop, loop.events, (int)next, got_int);
+ LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, (int)next, got_int);
os_breakcheck();
}
}
@@ -7857,19 +7860,26 @@ static void ex_stopinsert(exarg_T *eap)
*/
void exec_normal_cmd(char_u *cmd, int remap, bool silent)
{
+ // Stuff the argument into the typeahead buffer.
+ ins_typebuf(cmd, remap, 0, true, silent);
+ exec_normal(false);
+}
+
+/// Execute normal_cmd() until there is no typeahead left.
+///
+/// @param was_typed whether or not something was typed
+void exec_normal(bool was_typed)
+{
oparg_T oa;
- /*
- * Stuff the argument into the typeahead buffer.
- * Execute normal_cmd() until there is no typeahead left.
- */
clear_oparg(&oa);
- finish_op = FALSE;
- ins_typebuf(cmd, remap, 0, TRUE, silent);
- while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
+ finish_op = false;
+ while ((!stuff_empty()
+ || ((was_typed || !typebuf_typed())
+ && typebuf.tb_len > 0))
&& !got_int) {
update_topline_cursor();
- normal_cmd(&oa, TRUE); /* execute a Normal mode cmd */
+ normal_cmd(&oa, true); // execute a Normal mode cmd
}
}