0
0
mirror of https://github.com/vim/vim.git synced 2025-10-23 08:44:20 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-12-16 18:27:02 +01:00
parent 6621605eb9
commit 7e1652c63c
12 changed files with 201 additions and 18 deletions

View File

@@ -47,6 +47,16 @@ dict_alloc(void)
return d;
}
dict_T *
dict_alloc_lock(int lock)
{
dict_T *d = dict_alloc();
if (d != NULL)
d->dv_lock = lock;
return d;
}
/*
* Allocate an empty dict for a return value.
* Returns OK or FAIL.
@@ -54,13 +64,12 @@ dict_alloc(void)
int
rettv_dict_alloc(typval_T *rettv)
{
dict_T *d = dict_alloc();
dict_T *d = dict_alloc_lock(0);
if (d == NULL)
return FAIL;
rettv_dict_set(rettv, d);
rettv->v_lock = 0;
return OK;
}
@@ -80,7 +89,7 @@ rettv_dict_set(typval_T *rettv, dict_T *d)
* Free a Dictionary, including all non-container items it contains.
* Ignores the reference count.
*/
static void
void
dict_free_contents(dict_T *d)
{
int todo;
@@ -102,6 +111,8 @@ dict_free_contents(dict_T *d)
--todo;
}
}
/* The hashtab is still locked, it has to be re-initialized anyway */
hash_clear(&d->dv_hashtab);
}
@@ -846,4 +857,23 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
}
}
/*
* Make each item in the dict readonly (not the value of the item).
*/
void
dict_set_items_ro(dict_T *di)
{
int todo = (int)di->dv_hashtab.ht_used;
hashitem_T *hi;
/* Set readonly */
for (hi = di->dv_hashtab.ht_array; todo > 0 ; ++hi)
{
if (HASHITEM_EMPTY(hi))
continue;
--todo;
HI2DI(hi)->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX;
}
}
#endif /* defined(FEAT_EVAL) */