comparison 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
comparison
equal deleted inserted replaced
25789:3afd5ab3d69a 25790:16a7d1154be8
1384 } 1384 }
1385 # endif 1385 # endif
1386 #endif 1386 #endif
1387 1387
1388 VIsual_active = FALSE; 1388 VIsual_active = FALSE;
1389 trigger_modechanged();
1389 setmouse(); 1390 setmouse();
1390 mouse_dragging = 0; 1391 mouse_dragging = 0;
1391 1392
1392 // Save the current VIsual area for '< and '> marks, and "gv" 1393 // Save the current VIsual area for '< and '> marks, and "gv"
1393 curbuf->b_visual.vi_mode = VIsual_mode; 1394 curbuf->b_visual.vi_mode = VIsual_mode;
5640 end_visual_mode(); 5641 end_visual_mode();
5641 else // toggle char/block mode 5642 else // toggle char/block mode
5642 { // or char/line mode 5643 { // or char/line mode
5643 VIsual_mode = cap->cmdchar; 5644 VIsual_mode = cap->cmdchar;
5644 showmode(); 5645 showmode();
5646 trigger_modechanged();
5645 } 5647 }
5646 redraw_curbuf_later(INVERTED); // update the inversion 5648 redraw_curbuf_later(INVERTED); // update the inversion
5647 } 5649 }
5648 else // start Visual mode 5650 else // start Visual mode
5649 { 5651 {
5755 #endif 5757 #endif
5756 5758
5757 VIsual_mode = c; 5759 VIsual_mode = c;
5758 VIsual_active = TRUE; 5760 VIsual_active = TRUE;
5759 VIsual_reselect = TRUE; 5761 VIsual_reselect = TRUE;
5762 trigger_modechanged();
5760 5763
5761 // Corner case: the 0 position in a tab may change when going into 5764 // Corner case: the 0 position in a tab may change when going into
5762 // virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting. 5765 // virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting.
5763 if (c == Ctrl_V && (get_ve_flags() & VE_BLOCK) && gchar_cursor() == TAB) 5766 if (c == Ctrl_V && (get_ve_flags() & VE_BLOCK) && gchar_cursor() == TAB)
5764 { 5767 {