patch 8.2.4723: the ModeChanged autocmd event is inefficient
Problem: The ModeChanged autocmd event is inefficient.
Solution: Avoid allocating memory. (closes #10134) Rename
trigger_modechanged() to may_trigger_modechanged().
diff --git a/src/insexpand.c b/src/insexpand.c
index b7b6c02..2c549f8 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -257,7 +257,7 @@
// CTRL-V look like CTRL-N
ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X;
- trigger_modechanged();
+ may_trigger_modechanged();
}
/*
@@ -2381,7 +2381,7 @@
// upon the (possibly failed) completion.
ins_apply_autocmds(EVENT_COMPLETEDONE);
- trigger_modechanged();
+ may_trigger_modechanged();
// reset continue_* if we left expansion-mode, if we stay they'll be
// (re)set properly in ins_complete()
@@ -2865,7 +2865,7 @@
// Lazily show the popup menu, unless we got interrupted.
if (!compl_interrupted)
show_pum(save_w_wrow, save_w_leftcol);
- trigger_modechanged();
+ may_trigger_modechanged();
out_flush();
}
@@ -3818,7 +3818,7 @@
if (compl_curr_match == NULL)
compl_curr_match = compl_old_match;
}
- trigger_modechanged();
+ may_trigger_modechanged();
return i;
}