diff src/optionstr.c @ 29387:9dce192d1ac2 v9.0.0036

patch 9.0.0036: 'fillchars' cannot have window-local values Commit: https://github.com/vim/vim/commit/96ba25ac01279f73c0ecb5d4aa4ff37aa359e5eb Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 4 17:34:33 2022 +0100 patch 9.0.0036: 'fillchars' cannot have window-local values Problem: 'fillchars' cannot have window-local values. Solution: Make 'fillchars' global-local. (closes https://github.com/vim/vim/issues/5206)
author Bram Moolenaar <Bram@vim.org>
date Mon, 04 Jul 2022 18:45:04 +0200
parents be6c32395444
children 73fb9c6efc6d
line wrap: on
line diff
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -1311,7 +1311,7 @@ ambw_end:
 	if (errmsg == NULL)
 	{
 	    tabpage_T	*tp;
-	    win_T		*wp;
+	    win_T	*wp;
 
 	    // The current window is set to use the global 'listchars' value.
 	    // So clear the window-local value.
@@ -1320,12 +1320,12 @@ ambw_end:
 	    FOR_ALL_TAB_WINDOWS(tp, wp)
 		// If no error was returned above, we don't expect an error
 		// here, so ignore the return value.
-		(void)set_chars_option(wp, &wp->w_p_lcs);
+		if (*wp->w_p_lcs == NUL)
+		    (void)set_chars_option(wp, &wp->w_p_lcs);
 
 	    redraw_all_later(NOT_VALID);
 	}
     }
-
     // local 'listchars'
     else if (varp == &curwin->w_p_lcs)
 	errmsg = set_chars_option(curwin, varp);
@@ -1334,6 +1334,28 @@ ambw_end:
     else if (varp == &p_fcs)
     {
 	errmsg = set_chars_option(curwin, varp);
+	if (errmsg == NULL)
+	{
+	    tabpage_T	*tp;
+	    win_T	*wp;
+
+	    // The current window is set to use the global 'fillchars' value.
+	    // So clear the window-local value.
+	    if (!(opt_flags & OPT_GLOBAL))
+		clear_string_option(&curwin->w_p_fcs);
+	    FOR_ALL_TAB_WINDOWS(tp, wp)
+		// If no error was returned above, we don't expect an error
+		// here, so ignore the return value.
+		if (*wp->w_p_fcs == NUL)
+		    (void)set_chars_option(wp, &wp->w_p_fcs);
+
+	    redraw_all_later(NOT_VALID);
+	}
+    }
+    // local 'fillchars'
+    else if (varp == &curwin->w_p_fcs)
+    {
+	errmsg = set_chars_option(curwin, varp);
     }
 
 #ifdef FEAT_CMDWIN