summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-09 23:26:40 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-09 23:26:40 +0100
commitee85702c10495041791f728e977b86005c4496e8 (patch)
treead3a4d7d4d477299da5349d8b9d234243ca33d66 /src/option.c
parentb0745b221d284e381f1bd4b591cd68ea54b6a51d (diff)
downloadvim-git-ee85702c10495041791f728e977b86005c4496e8.tar.gz
patch 8.1.2281: 'showbreak' cannot be set for one windowv8.1.2281
Problem: 'showbreak' cannot be set for one window. Solution: Make 'showbreak' global-local.
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/option.c b/src/option.c
index 935ee2d9d..313882148 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5167,6 +5167,11 @@ unset_global_local_option(char_u *name, void *from)
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 @@ get_varp_scope(struct vimoption *p, int opt_flags)
#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 @@ get_varp(struct vimoption *p)
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 @@ copy_winopt(winopt_T *from, winopt_T *to)
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 @@ check_winopt(winopt_T *wop UNUSED)
#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 @@ clear_winopt(winopt_T *wop UNUSED)
#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 @@ get_bkc_value(buf_T *buf)
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.