summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-12-16 18:27:02 +0100
committerBram Moolenaar <Bram@vim.org>2017-12-16 18:27:02 +0100
commit7e1652c63c96585b9e2235c195a3c322b1f11595 (patch)
treeed90a314ef58909b1c9dfbd45422f1a3557de278 /src/eval.c
parent6621605eb97cf5fbc481282fd4d349a76e168f16 (diff)
patch 8.0.1394: cannot intercept a yank commandv8.0.1394
Problem: Cannot intercept a yank command. Solution: Add the TextYankPost autocommand event. (Philippe Vaucher et al., closes #2333)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/eval.c b/src/eval.c
index 1cced57ec0..85f607cb77 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -192,6 +192,7 @@ static struct vimvar
{VV_NAME("termu7resp", VAR_STRING), VV_RO},
{VV_NAME("termstyleresp", VAR_STRING), VV_RO},
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
+ {VV_NAME("event", VAR_DICT), VV_RO},
};
/* shorthand */
@@ -319,8 +320,9 @@ eval_init(void)
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
set_vim_var_nr(VV_HLSEARCH, 1L);
- set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
+ set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED));
set_vim_var_list(VV_ERRORS, list_alloc());
+ set_vim_var_dict(VV_EVENT, dict_alloc_lock(VAR_FIXED));
set_vim_var_nr(VV_FALSE, VVAL_FALSE);
set_vim_var_nr(VV_TRUE, VVAL_TRUE);
@@ -6633,6 +6635,16 @@ get_vim_var_list(int idx)
}
/*
+ * Get Dict v: variable value. Caller must take care of reference count when
+ * needed.
+ */
+ dict_T *
+get_vim_var_dict(int idx)
+{
+ return vimvars[idx].vv_dict;
+}
+
+/*
* Set v:char to character "c".
*/
void
@@ -6706,25 +6718,13 @@ set_vim_var_list(int idx, list_T *val)
void
set_vim_var_dict(int idx, dict_T *val)
{
- int todo;
- hashitem_T *hi;
-
clear_tv(&vimvars[idx].vv_di.di_tv);
vimvars[idx].vv_type = VAR_DICT;
vimvars[idx].vv_dict = val;
if (val != NULL)
{
++val->dv_refcount;
-
- /* Set readonly */
- todo = (int)val->dv_hashtab.ht_used;
- for (hi = val->dv_hashtab.ht_array; todo > 0 ; ++hi)
- {
- if (HASHITEM_EMPTY(hi))
- continue;
- --todo;
- HI2DI(hi)->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX;
- }
+ dict_set_items_ro(val);
}
}