Mercurial > vim
comparison src/insexpand.c @ 26155:f2392648af3e v8.2.3609
patch 8.2.3609: internal error when ModeChanged is triggered recursively
Commit: https://github.com/vim/vim/commit/3075a45592fe76f2febb6321632a23e352efe949
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 17 15:51:52 2021 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Nov 2021 17:00:05 +0100 |
parents | 6b39ab99e367 |
children | dbe615b75f15 |
comparison
equal
deleted
inserted
replaced
26154:fa84cd94d8b6 | 26155:f2392648af3e |
---|---|
960 if (strstr((char *)p_cot, "menuone") != NULL) | 960 if (strstr((char *)p_cot, "menuone") != NULL) |
961 return (i >= 1); | 961 return (i >= 1); |
962 return (i >= 2); | 962 return (i >= 2); |
963 } | 963 } |
964 | 964 |
965 #ifdef FEAT_EVAL | 965 #if defined(FEAT_EVAL) || defined(PROTO) |
966 /* | 966 /* |
967 * Allocate Dict for the completed item. | 967 * Allocate Dict for the completed item. |
968 * { word, abbr, menu, kind, info } | 968 * { word, abbr, menu, kind, info } |
969 */ | 969 */ |
970 static dict_T * | 970 static dict_T * |
991 trigger_complete_changed_event(int cur) | 991 trigger_complete_changed_event(int cur) |
992 { | 992 { |
993 dict_T *v_event; | 993 dict_T *v_event; |
994 dict_T *item; | 994 dict_T *item; |
995 static int recursive = FALSE; | 995 static int recursive = FALSE; |
996 save_v_event_T save_v_event; | |
996 | 997 |
997 if (recursive) | 998 if (recursive) |
998 return; | 999 return; |
999 | 1000 |
1000 v_event = get_vim_var_dict(VV_EVENT); | |
1001 if (cur < 0) | 1001 if (cur < 0) |
1002 item = dict_alloc(); | 1002 item = dict_alloc(); |
1003 else | 1003 else |
1004 item = ins_compl_dict_alloc(compl_curr_match); | 1004 item = ins_compl_dict_alloc(compl_curr_match); |
1005 if (item == NULL) | 1005 if (item == NULL) |
1006 return; | 1006 return; |
1007 v_event = get_v_event(&save_v_event); | |
1007 dict_add_dict(v_event, "completed_item", item); | 1008 dict_add_dict(v_event, "completed_item", item); |
1008 pum_set_event_info(v_event); | 1009 pum_set_event_info(v_event); |
1009 dict_set_items_ro(v_event); | 1010 dict_set_items_ro(v_event); |
1010 | 1011 |
1011 recursive = TRUE; | 1012 recursive = TRUE; |
1012 textwinlock++; | 1013 textwinlock++; |
1013 apply_autocmds(EVENT_COMPLETECHANGED, NULL, NULL, FALSE, curbuf); | 1014 apply_autocmds(EVENT_COMPLETECHANGED, NULL, NULL, FALSE, curbuf); |
1014 textwinlock--; | 1015 textwinlock--; |
1015 recursive = FALSE; | 1016 recursive = FALSE; |
1016 | 1017 |
1017 dict_free_contents(v_event); | 1018 restore_v_event(v_event, &save_v_event); |
1018 hash_init(&v_event->dv_hashtab); | |
1019 } | 1019 } |
1020 #endif | 1020 #endif |
1021 | 1021 |
1022 /* | 1022 /* |
1023 * Show the popup menu for the list of matches. | 1023 * Show the popup menu for the list of matches. |