patch 8.1.2281: 'showbreak' cannot be set for one window
Problem: 'showbreak' cannot be set for one window.
Solution: Make 'showbreak' global-local.
diff --git a/src/option.c b/src/option.c
index 935ee2d..3138821 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5167,6 +5167,11 @@
clear_string_option(&buf->b_p_cm);
break;
#endif
+#ifdef FEAT_LINEBREAK
+ case PV_SBR:
+ clear_string_option(&((win_T *)from)->w_p_sbr);
+ break;
+#endif
#ifdef FEAT_STL_OPT
case PV_STL:
clear_string_option(&((win_T *)from)->w_p_stl);
@@ -5229,6 +5234,9 @@
#if defined(FEAT_CRYPT)
case PV_CM: return (char_u *)&(curbuf->b_p_cm);
#endif
+#ifdef FEAT_LINEBREAK
+ case PV_SBR: return (char_u *)&(curwin->w_p_sbr);
+#endif
#ifdef FEAT_STL_OPT
case PV_STL: return (char_u *)&(curwin->w_p_stl);
#endif
@@ -5315,6 +5323,10 @@
case PV_CM: return *curbuf->b_p_cm != NUL
? (char_u *)&(curbuf->b_p_cm) : p->var;
#endif
+#ifdef FEAT_LINEBREAK
+ case PV_SBR: return *curwin->w_p_sbr != NUL
+ ? (char_u *)&(curwin->w_p_sbr) : p->var;
+#endif
#ifdef FEAT_STL_OPT
case PV_STL: return *curwin->w_p_stl != NUL
? (char_u *)&(curwin->w_p_stl) : p->var;
@@ -5581,6 +5593,9 @@
to->wo_rl = from->wo_rl;
to->wo_rlc = vim_strsave(from->wo_rlc);
#endif
+#ifdef FEAT_LINEBREAK
+ to->wo_sbr = vim_strsave(from->wo_sbr);
+#endif
#ifdef FEAT_STL_OPT
to->wo_stl = vim_strsave(from->wo_stl);
#endif
@@ -5682,6 +5697,9 @@
#ifdef FEAT_RIGHTLEFT
check_string_option(&wop->wo_rlc);
#endif
+#ifdef FEAT_LINEBREAK
+ check_string_option(&wop->wo_sbr);
+#endif
#ifdef FEAT_STL_OPT
check_string_option(&wop->wo_stl);
#endif
@@ -5728,6 +5746,9 @@
#ifdef FEAT_RIGHTLEFT
clear_string_option(&wop->wo_rlc);
#endif
+#ifdef FEAT_LINEBREAK
+ clear_string_option(&wop->wo_sbr);
+#endif
#ifdef FEAT_STL_OPT
clear_string_option(&wop->wo_stl);
#endif
@@ -7257,6 +7278,21 @@
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
}
+#if defined(FEAT_LINEBREAK) || defined(PROTO)
+/*
+ * Get the local or global value of 'showbreak'.
+ */
+ char_u *
+get_showbreak_value(win_T *win)
+{
+ if (win->w_p_sbr == NULL || *win->w_p_sbr == NUL)
+ return p_sbr;
+ if (STRCMP(win->w_p_sbr, "NONE") == 0)
+ return empty_option;
+ return win->w_p_sbr;
+}
+#endif
+
#if defined(FEAT_SIGNS) || defined(PROTO)
/*
* Return TRUE when window "wp" has a column to draw signs in.