summaryrefslogtreecommitdiff
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-17 15:51:52 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-17 15:51:52 +0000
commit3075a45592fe76f2febb6321632a23e352efe949 (patch)
tree03456a8d38fac32baca2c5157b264f2c759e55c4 /src/insexpand.c
parent125ffd21f9601a90b845f1d50c24da0d3938bb59 (diff)
downloadvim-git-3075a45592fe76f2febb6321632a23e352efe949.tar.gz
patch 8.2.3609: internal error when ModeChanged is triggered recursivelyv8.2.3609
Problem: Internal error when ModeChanged is triggered when v:event is already in use. Solution: Save and restore v:event if needed.
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index c993d9670..e9b48616d 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -962,7 +962,7 @@ pum_enough_matches(void)
return (i >= 2);
}
-#ifdef FEAT_EVAL
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Allocate Dict for the completed item.
* { word, abbr, menu, kind, info }
@@ -993,17 +993,18 @@ trigger_complete_changed_event(int cur)
dict_T *v_event;
dict_T *item;
static int recursive = FALSE;
+ save_v_event_T save_v_event;
if (recursive)
return;
- v_event = get_vim_var_dict(VV_EVENT);
if (cur < 0)
item = dict_alloc();
else
item = ins_compl_dict_alloc(compl_curr_match);
if (item == NULL)
return;
+ v_event = get_v_event(&save_v_event);
dict_add_dict(v_event, "completed_item", item);
pum_set_event_info(v_event);
dict_set_items_ro(v_event);
@@ -1014,8 +1015,7 @@ trigger_complete_changed_event(int cur)
textwinlock--;
recursive = FALSE;
- dict_free_contents(v_event);
- hash_init(&v_event->dv_hashtab);
+ restore_v_event(v_event, &save_v_event);
}
#endif