diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-11-03 16:54:25 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-11-03 17:04:34 +0800 |
commit | fe565ca382bb6cc4cd9f1c01de42d62c48922bf6 (patch) | |
tree | fc6c3550d92cbce3da5e2b5552fb46c93663e2a7 /src/nvim/insexpand.c | |
parent | 981fa11c91d3655828b4f70ccf7d079d917d5b6b (diff) | |
download | rneovim-fe565ca382bb6cc4cd9f1c01de42d62c48922bf6.tar.gz rneovim-fe565ca382bb6cc4cd9f1c01de42d62c48922bf6.tar.bz2 rneovim-fe565ca382bb6cc4cd9f1c01de42d62c48922bf6.zip |
vim-patch:9.1.0835: :setglobal doesn't work properly for 'ffu' and 'tsrfu'
Problem: :setglobal doesn't work properly for 'ffu' and 'tsrfu' when
the local value is set (after v9.1.0831)
Solution: Check os_flags instead of buffer option variable (zeertzjq).
closes: vim/vim#15980
https://github.com/vim/vim/commit/6eda269600b5ca952f28e808c662f67e581933d7
Diffstat (limited to 'src/nvim/insexpand.c')
-rw-r--r-- | src/nvim/insexpand.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 2482cef7a1..c8314d1bb2 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -2368,13 +2368,13 @@ static void copy_global_to_buflocal_cb(Callback *globcb, Callback *bufcb) /// Invoked when the 'completefunc' option is set. The option value can be a /// name of a function (string), or function(<name>) or funcref(<name>) or a /// lambda expression. -const char *did_set_completefunc(optset_T *args FUNC_ATTR_UNUSED) +const char *did_set_completefunc(optset_T *args) { - if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) { + buf_T *buf = (buf_T *)args->os_buf; + if (option_set_callback_func(buf->b_p_cfu, &cfu_cb) == FAIL) { return e_invarg; } - - set_buflocal_cfu_callback(curbuf); + set_buflocal_cfu_callback(buf); return NULL; } @@ -2412,14 +2412,19 @@ void set_buflocal_ofu_callback(buf_T *buf) /// lambda expression. const char *did_set_thesaurusfunc(optset_T *args FUNC_ATTR_UNUSED) { + buf_T *buf = (buf_T *)args->os_buf; int retval; - if (*curbuf->b_p_tsrfu != NUL) { + if (args->os_flags & OPT_LOCAL) { // buffer-local option set - retval = option_set_callback_func(curbuf->b_p_tsrfu, &curbuf->b_tsrfu_cb); + retval = option_set_callback_func(buf->b_p_tsrfu, &buf->b_tsrfu_cb); } else { // global option set retval = option_set_callback_func(p_tsrfu, &tsrfu_cb); + // when using :set, free the local callback + if (!(args->os_flags & OPT_GLOBAL)) { + callback_free(&buf->b_tsrfu_cb); + } } return retval == FAIL ? e_invarg : NULL; |