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

@@ -1067,12 +1067,13 @@ void trigger_modechanged(void)
return;
}
dict_T *v_event = get_vim_var_dict(VV_EVENT);
char *mode = get_mode();
if (last_mode == NULL) {
last_mode = (char *)vim_strsave((char_u *)"n");
if (STRCMP(mode, last_mode) == 0) {
xfree(mode);
return;
}
dict_T *v_event = get_vim_var_dict(VV_EVENT);
tv_dict_add_str(v_event, S_LEN("new_mode"), mode);
tv_dict_add_str(v_event, S_LEN("old_mode"), last_mode);