0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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 #8856)
This commit is contained in:
=?UTF-8?q?Magnus=20Gro=C3=9F?=
2021-09-12 13:39:55 +02:00
committed by Bram Moolenaar
parent 464393a696
commit f1e8876fa2
13 changed files with 135 additions and 4 deletions

View File

@@ -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.