comparison src/eval.c @ 13037:6e81a68d63a1 v8.0.1394

patch 8.0.1394: cannot intercept a yank command commit https://github.com/vim/vim/commit/7e1652c63c96585b9e2235c195a3c322b1f11595 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 16 18:27:02 2017 +0100 patch 8.0.1394: cannot intercept a yank command Problem: Cannot intercept a yank command. Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al., closes #2333)
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Dec 2017 18:30:05 +0100
parents f7b2ecaeb79c
children ac42c4b11dbc
comparison
equal deleted inserted replaced
13036:754780887de1 13037:6e81a68d63a1
190 {VV_NAME("termrfgresp", VAR_STRING), VV_RO}, 190 {VV_NAME("termrfgresp", VAR_STRING), VV_RO},
191 {VV_NAME("termrbgresp", VAR_STRING), VV_RO}, 191 {VV_NAME("termrbgresp", VAR_STRING), VV_RO},
192 {VV_NAME("termu7resp", VAR_STRING), VV_RO}, 192 {VV_NAME("termu7resp", VAR_STRING), VV_RO},
193 {VV_NAME("termstyleresp", VAR_STRING), VV_RO}, 193 {VV_NAME("termstyleresp", VAR_STRING), VV_RO},
194 {VV_NAME("termblinkresp", VAR_STRING), VV_RO}, 194 {VV_NAME("termblinkresp", VAR_STRING), VV_RO},
195 {VV_NAME("event", VAR_DICT), VV_RO},
195 }; 196 };
196 197
197 /* shorthand */ 198 /* shorthand */
198 #define vv_type vv_di.di_tv.v_type 199 #define vv_type vv_di.di_tv.v_type
199 #define vv_nr vv_di.di_tv.vval.v_number 200 #define vv_nr vv_di.di_tv.vval.v_number
317 } 318 }
318 vimvars[VV_VERSION].vv_nr = VIM_VERSION_100; 319 vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
319 320
320 set_vim_var_nr(VV_SEARCHFORWARD, 1L); 321 set_vim_var_nr(VV_SEARCHFORWARD, 1L);
321 set_vim_var_nr(VV_HLSEARCH, 1L); 322 set_vim_var_nr(VV_HLSEARCH, 1L);
322 set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc()); 323 set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
323 set_vim_var_list(VV_ERRORS, list_alloc()); 324 set_vim_var_list(VV_ERRORS, list_alloc());
325 set_vim_var_dict(VV_EVENT, dict_alloc_lock(VAR_FIXED));
324 326
325 set_vim_var_nr(VV_FALSE, VVAL_FALSE); 327 set_vim_var_nr(VV_FALSE, VVAL_FALSE);
326 set_vim_var_nr(VV_TRUE, VVAL_TRUE); 328 set_vim_var_nr(VV_TRUE, VVAL_TRUE);
327 set_vim_var_nr(VV_NONE, VVAL_NONE); 329 set_vim_var_nr(VV_NONE, VVAL_NONE);
328 set_vim_var_nr(VV_NULL, VVAL_NULL); 330 set_vim_var_nr(VV_NULL, VVAL_NULL);
6631 { 6633 {
6632 return vimvars[idx].vv_list; 6634 return vimvars[idx].vv_list;
6633 } 6635 }
6634 6636
6635 /* 6637 /*
6638 * Get Dict v: variable value. Caller must take care of reference count when
6639 * needed.
6640 */
6641 dict_T *
6642 get_vim_var_dict(int idx)
6643 {
6644 return vimvars[idx].vv_dict;
6645 }
6646
6647 /*
6636 * Set v:char to character "c". 6648 * Set v:char to character "c".
6637 */ 6649 */
6638 void 6650 void
6639 set_vim_var_char(int c) 6651 set_vim_var_char(int c)
6640 { 6652 {
6704 * Set Dictionary v: variable to "val". 6716 * Set Dictionary v: variable to "val".
6705 */ 6717 */
6706 void 6718 void
6707 set_vim_var_dict(int idx, dict_T *val) 6719 set_vim_var_dict(int idx, dict_T *val)
6708 { 6720 {
6709 int todo;
6710 hashitem_T *hi;
6711
6712 clear_tv(&vimvars[idx].vv_di.di_tv); 6721 clear_tv(&vimvars[idx].vv_di.di_tv);
6713 vimvars[idx].vv_type = VAR_DICT; 6722 vimvars[idx].vv_type = VAR_DICT;
6714 vimvars[idx].vv_dict = val; 6723 vimvars[idx].vv_dict = val;
6715 if (val != NULL) 6724 if (val != NULL)
6716 { 6725 {
6717 ++val->dv_refcount; 6726 ++val->dv_refcount;
6718 6727 dict_set_items_ro(val);
6719 /* Set readonly */
6720 todo = (int)val->dv_hashtab.ht_used;
6721 for (hi = val->dv_hashtab.ht_array; todo > 0 ; ++hi)
6722 {
6723 if (HASHITEM_EMPTY(hi))
6724 continue;
6725 --todo;
6726 HI2DI(hi)->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX;
6727 }
6728 } 6728 }
6729 } 6729 }
6730 6730
6731 /* 6731 /*
6732 * Set v:register if needed. 6732 * Set v:register if needed.