Mercurial > vim
comparison src/register.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 | 14a55d1520f2 |
children | b79f122c6bd8 |
comparison
equal
deleted
inserted
replaced
26154:fa84cd94d8b6 | 26155:f2392648af3e |
---|---|
989 | 989 |
990 #if defined(FEAT_EVAL) | 990 #if defined(FEAT_EVAL) |
991 void | 991 void |
992 yank_do_autocmd(oparg_T *oap, yankreg_T *reg) | 992 yank_do_autocmd(oparg_T *oap, yankreg_T *reg) |
993 { | 993 { |
994 static int recursive = FALSE; | 994 static int recursive = FALSE; |
995 dict_T *v_event; | 995 dict_T *v_event; |
996 list_T *list; | 996 list_T *list; |
997 int n; | 997 int n; |
998 char_u buf[NUMBUFLEN + 2]; | 998 char_u buf[NUMBUFLEN + 2]; |
999 long reglen = 0; | 999 long reglen = 0; |
1000 save_v_event_T save_v_event; | |
1000 | 1001 |
1001 if (recursive) | 1002 if (recursive) |
1002 return; | 1003 return; |
1003 | 1004 |
1004 v_event = get_vim_var_dict(VV_EVENT); | 1005 v_event = get_v_event(&save_v_event); |
1005 | 1006 |
1006 list = list_alloc(); | 1007 list = list_alloc(); |
1007 if (list == NULL) | 1008 if (list == NULL) |
1008 return; | 1009 return; |
1009 for (n = 0; n < reg->y_size; n++) | 1010 for (n = 0; n < reg->y_size; n++) |
1043 apply_autocmds(EVENT_TEXTYANKPOST, NULL, NULL, FALSE, curbuf); | 1044 apply_autocmds(EVENT_TEXTYANKPOST, NULL, NULL, FALSE, curbuf); |
1044 textwinlock--; | 1045 textwinlock--; |
1045 recursive = FALSE; | 1046 recursive = FALSE; |
1046 | 1047 |
1047 // Empty the dictionary, v:event is still valid | 1048 // Empty the dictionary, v:event is still valid |
1048 dict_free_contents(v_event); | 1049 restore_v_event(v_event, &save_v_event); |
1049 hash_init(&v_event->dv_hashtab); | |
1050 } | 1050 } |
1051 #endif | 1051 #endif |
1052 | 1052 |
1053 /* | 1053 /* |
1054 * set all the yank registers to empty (called from main()) | 1054 * set all the yank registers to empty (called from main()) |