diff src/normal.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 ec62e0764ffa
children 203b0f3a741a
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -1386,6 +1386,7 @@ end_visual_mode_keep_button()
 #endif
 
     VIsual_active = FALSE;
+    trigger_modechanged();
     setmouse();
     mouse_dragging = 0;
 
@@ -5642,6 +5643,7 @@ nv_visual(cmdarg_T *cap)
 	{				    //	   or char/line mode
 	    VIsual_mode = cap->cmdchar;
 	    showmode();
+	    trigger_modechanged();
 	}
 	redraw_curbuf_later(INVERTED);	    // update the inversion
     }
@@ -5757,6 +5759,7 @@ n_start_visual_mode(int c)
     VIsual_mode = c;
     VIsual_active = TRUE;
     VIsual_reselect = TRUE;
+    trigger_modechanged();
 
     // Corner case: the 0 position in a tab may change when going into
     // virtualedit.  Recalculate curwin->w_cursor to avoid bad highlighting.