fix(api): notify dict watchers on nvim_set_var and vim.g setter

Co-authored-by: bfredl <bjorn.linse@gmail.com>
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
This commit is contained in:
smolck
2021-08-14 12:19:05 -05:00
committed by bfredl
parent 1d337d4e2f
commit c7d30c152d
5 changed files with 103 additions and 7 deletions

View File

@@ -1781,7 +1781,7 @@ void tv_dict_watcher_notify(dict_T *const dict, const char *const key, typval_T
tv_dict_add(argv[2].vval.v_dict, v);
}
if (oldtv) {
if (oldtv && oldtv->v_type != VAR_UNKNOWN) {
dictitem_T *const v = tv_dict_item_alloc_len(S_LEN("old"));
tv_copy(oldtv, &v->di_tv);
tv_dict_add(argv[2].vval.v_dict, v);