diff options
author | =?UTF-8?q?Magnus=20Gro=C3=9F?= <magnus.gross@rwth-aachen.de> | 2021-10-22 18:56:39 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-22 18:56:39 +0100 |
commit | 25def2c8b8bd7b0c3d5f020207c717a880b05d50 (patch) | |
tree | 297dc3f2ad09266c34bdf4c518ff5ebcc588bb4d /src/misc1.c | |
parent | a2ffb435209716dc7aeb4783333f6ea19f5d28a7 (diff) | |
download | vim-git-25def2c8b8bd7b0c3d5f020207c717a880b05d50.tar.gz |
patch 8.2.3555: ModeChanged is not triggered on every mode changev8.2.3555
Problem: ModeChanged is not triggered on every mode change.
Solution: Also trigger on minor mode changes. (Maguns Gross, closes #8999)
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/misc1.c b/src/misc1.c index 109b7bb0c..58f515dff 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2670,12 +2670,17 @@ trigger_modechanged() if (!has_modechanged()) return; - v_event = get_vim_var_dict(VV_EVENT); - tv[0].v_type = VAR_NUMBER; tv[0].vval.v_number = 1; // get full mode tv[1].v_type = VAR_UNKNOWN; f_mode(tv, &rettv); + if (STRCMP(rettv.vval.v_string, last_mode) == 0) + { + vim_free(rettv.vval.v_string); + return; + } + + v_event = get_vim_var_dict(VV_EVENT); (void)dict_add_string(v_event, "new_mode", rettv.vval.v_string); (void)dict_add_string(v_event, "old_mode", last_mode); dict_set_items_ro(v_event); @@ -2688,9 +2693,9 @@ trigger_modechanged() apply_autocmds(EVENT_MODECHANGED, pat, NULL, FALSE, curbuf); STRCPY(last_mode, rettv.vval.v_string); - vim_free(rettv.vval.v_string); vim_free(pat); dict_free_contents(v_event); hash_init(&v_event->dv_hashtab); + vim_free(rettv.vval.v_string); #endif } |