diff options
author | Famiu Haque <famiuhaque@proton.me> | 2023-10-08 22:13:15 +0600 |
---|---|---|
committer | Famiu Haque <famiuhaque@proton.me> | 2023-10-17 00:08:47 +0600 |
commit | 5df4fdf253f9c9cc35f9f5f16c6d0ba9d87b4c71 (patch) | |
tree | 526161313a7690d2c944c7449e183e3a26f2d1c5 /src/nvim/eval.c | |
parent | 93b9c889465ee6a55e71c1fd681c1c6b1d5ed060 (diff) | |
download | rneovim-5df4fdf253f9c9cc35f9f5f16c6d0ba9d87b4c71.tar.gz rneovim-5df4fdf253f9c9cc35f9f5f16c6d0ba9d87b4c71.tar.bz2 rneovim-5df4fdf253f9c9cc35f9f5f16c6d0ba9d87b4c71.zip |
refactor(options)!: make OptionSet `v:` values use typval
BREAKING CHANGE: This breaks the OptionSet autocommand, as the `v:` values associated with it (`v:option_new`, `v:option_old`, `v:option_oldlocal` and `v:option_oldglobal`) are now the same type as the option, instead of all option values being converted to strings.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b5b40061b5..ad7d327de3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7226,6 +7226,17 @@ void set_vim_var_dict(const VimVarIndex idx, dict_T *const val) tv_dict_set_keys_readonly(val); } +/// Set v:variable to tv. +/// +/// @param[in] idx Index of variable to set. +/// @param[in,out] val Value to set to. Reference count will be incremented. +/// Also keys of the dictionary will be made read-only. +void set_vim_var_tv(const VimVarIndex idx, typval_T *const tv) +{ + tv_clear(&vimvars[idx].vv_di.di_tv); + vimvars[idx].vv_di.di_tv = *tv; +} + /// Set the v:argv list. void set_argv_var(char **argv, int argc) { |