diff src/ex_getln.c @ 25790:16a7d1154be8 v8.2.3430

patch 8.2.3430: no generic way to trigger an autocommand on mode change Commit: https://github.com/vim/vim/commit/f1e8876fa2359b572d262772747405d3616db670 Author: =?UTF-8?q?Magnus=20Gro=C3=9F?= <magnus.gross@rwth-aachen.de> Date: Sun Sep 12 13:39:55 2021 +0200 patch 8.2.3430: no generic way to trigger an autocommand on mode change Problem: No generic way to trigger an autocommand on mode change. Solution: Add the ModeChanged autocommand event. (Magnus Gross, closes https://github.com/vim/vim/issues/8856)
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Sep 2021 13:45:05 +0200
parents e8e2c4d33b9b
children 054623fc54c5
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1696,6 +1696,10 @@ getcmdline_int(
     // Trigger CmdlineEnter autocommands.
     cmdline_type = firstc == NUL ? '-' : firstc;
     trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER);
+#ifdef FEAT_EVAL
+    if (!debug_mode)
+	trigger_modechanged();
+#endif
 
     init_history();
     hiscnt = get_hislen();	// set hiscnt to impossible history value
@@ -2461,6 +2465,12 @@ returncmd:
     trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE);
 
     State = save_State;
+
+#ifdef FEAT_EVAL
+    if (!debug_mode)
+	trigger_modechanged();
+#endif
+
 #ifdef HAVE_INPUT_METHOD
     if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
 	im_save_status(b_im_ptr);