1
0
forked from aniani/vim

patch 8.1.2281: 'showbreak' cannot be set for one window

Problem:    'showbreak' cannot be set for one window.
Solution:   Make 'showbreak' global-local.
This commit is contained in:
Bram Moolenaar
2019-11-09 23:26:40 +01:00
parent b0745b221d
commit ee85702c10
16 changed files with 104 additions and 30 deletions

View File

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