diff options
author | Magnus Groß <magnus.gross@rwth-aachen.de> | 2021-10-22 20:36:35 +0200 |
---|---|---|
committer | Magnus Groß <magnus.gross@rwth-aachen.de> | 2021-11-18 11:23:18 +0100 |
commit | 11683193f597e1b3144ba65f08056cd44b19175f (patch) | |
tree | 1e3a890b58f32ccccf7ff075bfd212530122d3d9 /src/nvim/autocmd.c | |
parent | 60c154687a8b8fbdb97cf3d394ae6aa5c6f90670 (diff) | |
download | rneovim-11683193f597e1b3144ba65f08056cd44b19175f.tar.gz rneovim-11683193f597e1b3144ba65f08056cd44b19175f.tar.bz2 rneovim-11683193f597e1b3144ba65f08056cd44b19175f.zip |
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)
https://github.com/vim/vim/commit/25def2c8b8bd7b0c3d5f020207c717a880b05d50
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r-- | src/nvim/autocmd.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index ae81b6a808..490fe5a0ac 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -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; |