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: #15980
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 380bd23..859dc85 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6934,6 +6934,9 @@
return *curbuf->b_p_ffu != NUL ? &curbuf->b_ffu_cb : &ffu_cb;
}
+/*
+ * Call 'findfunc' to obtain a list of file names.
+ */
static list_T *
call_findfunc(char_u *pat, int cmdcomplete)
{
@@ -6944,7 +6947,6 @@
sctx_T saved_sctx = current_sctx;
sctx_T *ctx;
- // Call 'findfunc' to obtain the list of file names.
args[0].v_type = VAR_STRING;
args[0].vval.v_string = pat;
args[1].v_type = VAR_BOOL;
@@ -7076,15 +7078,16 @@
{
int retval;
- if (*curbuf->b_p_ffu != NUL)
- {
+ if (args->os_flags & OPT_LOCAL)
// buffer-local option set
retval = option_set_callback_func(curbuf->b_p_ffu, &curbuf->b_ffu_cb);
- }
else
{
// global option set
retval = option_set_callback_func(p_ffu, &ffu_cb);
+ // when using :set, free the local callback
+ if (!(args->os_flags & OPT_GLOBAL))
+ free_callback(&curbuf->b_ffu_cb);
}
if (retval == FAIL)