diff src/mbyte.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 faf7fcd1c8d5
children caaf5b270018
line wrap: on
line diff
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4229,8 +4229,7 @@ theend:
 #if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO)
 /*
  * Return TRUE if string "s" is a valid utf-8 string.
- * When "end" is NULL stop at the first NUL.
- * When "end" is positive stop there.
+ * When "end" is NULL stop at the first NUL.  Otherwise stop at "end".
  */
     int
 utf_valid_string(char_u *s, char_u *end)
@@ -5529,6 +5528,7 @@ f_setcellwidths(typval_T *argvars, typva
     cw_interval_T   *table;
     cw_interval_T   *cw_table_save;
     size_t	    cw_table_size_save;
+    char	    *error = NULL;
 
     if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
 	return;
@@ -5648,30 +5648,36 @@ f_setcellwidths(typval_T *argvars, typva
     // Check that the new value does not conflict with 'fillchars' or
     // 'listchars'.
     if (set_chars_option(curwin, &p_fcs) != NULL)
-    {
-	emsg(_(e_conflicts_with_value_of_fillchars));
-	cw_table = cw_table_save;
-	cw_table_size = cw_table_size_save;
-	vim_free(table);
-	return;
-    }
+	error = e_conflicts_with_value_of_fillchars;
+    else if (set_chars_option(curwin, &p_lcs) != NULL)
+	error = e_conflicts_with_value_of_listchars;
     else
     {
-	tabpage_T	*tp;
-	win_T	*wp;
+	tabpage_T   *tp;
+	win_T	    *wp;
 
 	FOR_ALL_TAB_WINDOWS(tp, wp)
 	{
 	    if (set_chars_option(wp, &wp->w_p_lcs) != NULL)
 	    {
-		emsg((e_conflicts_with_value_of_listchars));
-		cw_table = cw_table_save;
-		cw_table_size = cw_table_size_save;
-		vim_free(table);
-		return;
+		error = e_conflicts_with_value_of_listchars;
+		break;
+	    }
+	    if (set_chars_option(wp, &wp->w_p_fcs) != NULL)
+	    {
+		error = e_conflicts_with_value_of_fillchars;
+		break;
 	    }
 	}
     }
+    if (error != NULL)
+    {
+	emsg(_(error));
+	cw_table = cw_table_save;
+	cw_table_size = cw_table_size_save;
+	vim_free(table);
+	return;
+    }
 
     vim_free(cw_table_save);
 }