summaryrefslogtreecommitdiffstats
path: root/src/autocmd.c
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2022-04-09 18:17:34 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-09 18:17:34 +0100
commit2bf52dd065495cbf28e28792f2c2d50d44546d9f (patch)
treef6c2fabb35e2f7f12f441d76048b3f1575f4a6b4 /src/autocmd.c
parent81b46a6ccd818609e1ca8cd410e26a58428c30ba (diff)
patch 8.2.4723: the ModeChanged autocmd event is inefficientv8.2.4723
Problem: The ModeChanged autocmd event is inefficient. Solution: Avoid allocating memory. (closes #10134) Rename trigger_modechanged() to may_trigger_modechanged().
Diffstat (limited to 'src/autocmd.c')
-rw-r--r--src/autocmd.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index a0065decba..3b384f5f96 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1240,17 +1240,7 @@ do_autocmd_event(
// need to initialize last_mode for the first ModeChanged
// autocmd
if (event == EVENT_MODECHANGED && !has_modechanged())
- {
- typval_T rettv;
- typval_T tv[2];
-
- tv[0].v_type = VAR_NUMBER;
- tv[0].vval.v_number = 1;
- tv[1].v_type = VAR_UNKNOWN;
- f_mode(tv, &rettv);
- STRCPY(last_mode, rettv.vval.v_string);
- vim_free(rettv.vval.v_string);
- }
+ get_mode(last_mode);
#endif
// Initialize the fields checked by the WinScrolled trigger to
// stop it from firing right after the first autocmd is defined.