vim-patch:8.2.3609: internal error when ModeChanged is triggered recursively

Problem:    Internal error when ModeChanged is triggered when v:event is
            already in use.
Solution:   Save and restore v:event if needed.
3075a45592

In the vim codebase there is no occurrence of get_vim_var_dict(VV_EVENT)
after the above patch, so in order to hold the same invariant in the
neovim codebase we needed to replace more occurrences than the related
vim patch.
This commit is contained in:
Magnus Groß
2021-11-17 17:55:49 +01:00
parent fdfd1eda43
commit 1fb101afe4
10 changed files with 67 additions and 20 deletions

View File

@@ -2719,12 +2719,13 @@ static bool pum_enough_matches(void)
static void trigger_complete_changed_event(int cur)
{
static bool recursive = false;
save_v_event_T save_v_event;
if (recursive) {
return;
}
dict_T *v_event = get_vim_var_dict(VV_EVENT);
dict_T *v_event = get_v_event(&save_v_event);
if (cur < 0) {
tv_dict_add_dict(v_event, S_LEN("completed_item"), tv_dict_alloc());
} else {
@@ -2740,7 +2741,7 @@ static void trigger_complete_changed_event(int cur)
textlock--;
recursive = false;
tv_dict_clear(v_event);
restore_v_event(v_event, &save_v_event);
}
/// Show the popup menu for the list of matches.