aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-09-27 18:16:58 +0200
committerGitHub <noreply@github.com>2022-09-27 18:16:58 +0200
commitd84abfeb1d9f0dbd03c6089a94756f2a8468a612 (patch)
tree4d194e67ecc3b626ff703bd0b13042fb6e4b57c9 /src/nvim/eval
parentf46060c4cbc1efe100019075214def53fe4d47b3 (diff)
parentc7d30c152d1639523d05154e245ea60ed9a51a2b (diff)
downloadrneovim-d84abfeb1d9f0dbd03c6089a94756f2a8468a612.tar.gz
rneovim-d84abfeb1d9f0dbd03c6089a94756f2a8468a612.tar.bz2
rneovim-d84abfeb1d9f0dbd03c6089a94756f2a8468a612.zip
Merge pull request #15373 from smolck/lua-notify-dictwatcher
fix(nvim): notify dict watchers on nvim_set_var and vim.g setter
Diffstat (limited to 'src/nvim/eval')
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/eval/vars.c8
2 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index f9aed7a966..5639414dad 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -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);
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 1c07fc4d45..4d7214205d 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -1348,12 +1348,8 @@ void set_var_const(const char *name, const size_t name_len, typval_T *const tv,
}
if (watched) {
- if (oldtv.v_type == VAR_UNKNOWN) {
- tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, NULL);
- } else {
- tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, &oldtv);
- tv_clear(&oldtv);
- }
+ tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, &oldtv);
+ tv_clear(&oldtv);
}
if (is_const) {