vim-patch:8.2.3555: ModeChanged is not triggered on every mode change

Problem:    ModeChanged is not triggered on every mode change.
Solution:   Also trigger on minor mode changes. (Maguns Gross, closes vim/vim#8999)
25def2c8b8
This commit is contained in:
Magnus Groß
2021-10-22 20:36:35 +02:00
parent 60c154687a
commit 11683193f5
6 changed files with 65 additions and 22 deletions

View File

@@ -925,6 +925,13 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c
return FAIL;
}
}
// need to initialize last_mode for the first ModeChanged autocmd
if (event == EVENT_MODECHANGED && !has_event(EVENT_MODECHANGED)) {
xfree(last_mode);
last_mode = get_mode();
}
ap->cmds = NULL;
*prev_ap = ap;
last_autopat[(int)event] = ap;