0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.2518: 'listchars' should be window-local

Problem:    'listchars' should be window-local.
Solution:   Make 'listchars' global-local. (Yegappan Lakshmanan, Marco Hinz,
            closes #5206, closes #7850)
This commit is contained in:
Bram Moolenaar
2021-02-15 20:38:25 +01:00
parent 7c5b3c0369
commit eed9d46293
20 changed files with 302 additions and 112 deletions

View File

@@ -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