summaryrefslogtreecommitdiff
path: root/src/optionstr.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-15 20:38:25 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-15 20:38:25 +0100
commiteed9d46293f0842aad0d50ff3a526f9a48b12421 (patch)
treeef3730ca3c0a7ede44fade0ea638975f43a65d5f /src/optionstr.c
parent7c5b3c03699a4ab31f47c24290852d441ea8c12a (diff)
downloadvim-git-eed9d46293f0842aad0d50ff3a526f9a48b12421.tar.gz
patch 8.2.2518: 'listchars' should be window-localv8.2.2518
Problem: 'listchars' should be window-local. Solution: Make 'listchars' global-local. (Yegappan Lakshmanan, Marco Hinz, closes #5206, closes #7850)
Diffstat (limited to 'src/optionstr.c')
-rw-r--r--src/optionstr.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/optionstr.c b/src/optionstr.c
index c8a5b0c65..a1cbe262f 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -862,10 +862,24 @@ did_set_string_option(
{
if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
errmsg = e_invarg;
- else if (set_chars_option(&p_lcs) != NULL)
- errmsg = _("E834: Conflicts with value of 'listchars'");
- else if (set_chars_option(&p_fcs) != NULL)
+ else if (set_chars_option(curwin, &p_fcs) != NULL)
errmsg = _("E835: Conflicts with value of 'fillchars'");
+ else
+ {
+ tabpage_T *tp;
+ win_T *wp;
+
+ FOR_ALL_TAB_WINDOWS(tp, wp)
+ {
+ if (set_chars_option(wp, &wp->w_p_lcs) != NULL)
+ {
+ errmsg = _("E834: Conflicts with value of 'listchars'");
+ goto ambw_end;
+ }
+ }
+ }
+ambw_end:
+ {}
}
// 'background'
@@ -1292,16 +1306,37 @@ did_set_string_option(
}
}
- // 'listchars'
+ // global 'listchars'
else if (varp == &p_lcs)
{
- errmsg = set_chars_option(varp);
+ errmsg = set_chars_option(curwin, varp);
+ if (errmsg == NULL)
+ {
+ tabpage_T *tp;
+ win_T *wp;
+
+ // The current window is set to use the global 'listchars' value.
+ // So clear the window-local value.
+ if (!(opt_flags & OPT_GLOBAL))
+ clear_string_option(&curwin->w_p_lcs);
+ FOR_ALL_TAB_WINDOWS(tp, wp)
+ {
+ errmsg = set_chars_option(wp, &wp->w_p_lcs);
+ if (errmsg)
+ break;
+ }
+ redraw_all_later(NOT_VALID);
+ }
}
+ // local 'listchars'
+ else if (varp == &curwin->w_p_lcs)
+ errmsg = set_chars_option(curwin, varp);
+
// 'fillchars'
else if (varp == &p_fcs)
{
- errmsg = set_chars_option(varp);
+ errmsg = set_chars_option(curwin, varp);
}
#ifdef FEAT_CMDWIN