vim-patch:7.4.417

Problem:    After splitting a window and setting 'breakindent' the default
            minimum with is not respected.
Solution:   Call briopt_check() when copying options to a new window.

https://code.google.com/p/vim/source/detail?r=v7-4-417
This commit is contained in:
Scott Prager 2014-10-11 19:29:38 -04:00
parent 24ebb018e2
commit c92e649a1e
3 changed files with 14 additions and 13 deletions

View File

@ -3481,7 +3481,7 @@ static void didset_options(void)
(void)compile_cap_prog(curwin->w_s); (void)compile_cap_prog(curwin->w_s);
/* set cedit_key */ /* set cedit_key */
(void)check_cedit(); (void)check_cedit();
briopt_check(); briopt_check(curwin);
} }
/* /*
@ -3818,7 +3818,7 @@ did_set_string_option (
} }
/* 'breakindentopt' */ /* 'breakindentopt' */
else if (varp == &curwin->w_p_briopt) { else if (varp == &curwin->w_p_briopt) {
if (briopt_check() == FAIL) if (briopt_check(curwin) == FAIL)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* /*
@ -6771,6 +6771,7 @@ void win_copy_options(win_T *wp_from, win_T *wp_to)
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
/* Is this right? */ /* Is this right? */
wp_to->w_farsi = wp_from->w_farsi; wp_to->w_farsi = wp_from->w_farsi;
briopt_check(wp_to);
} }
/* /*
@ -8143,16 +8144,15 @@ void find_mps_values(int *initc, int *findc, int *backwards, int switchit)
} }
} }
/* This is called when 'breakindentopt' is changed and when a window is /// This is called when 'breakindentopt' is changed and when a window is
initialized */ /// initialized
int briopt_check(void) static bool briopt_check(win_T *wp)
{ {
char_u *p;
int bri_shift = 0; int bri_shift = 0;
long bri_min = 20; long bri_min = 20;
bool bri_sbr = false; bool bri_sbr = false;
p = curwin->w_p_briopt; char_u *p = wp->w_p_briopt;
while (*p != NUL) while (*p != NUL)
{ {
if (STRNCMP(p, "shift:", 6) == 0 if (STRNCMP(p, "shift:", 6) == 0
@ -8172,15 +8172,15 @@ int briopt_check(void)
bri_sbr = true; bri_sbr = true;
} }
if (*p != ',' && *p != NUL) if (*p != ',' && *p != NUL)
return FAIL; return false;
if (*p == ',') if (*p == ',')
++p; ++p;
} }
curwin->w_p_brishift = bri_shift; wp->w_p_brishift = bri_shift;
curwin->w_p_brimin = bri_min; wp->w_p_brimin = bri_min;
curwin->w_p_brisbr = bri_sbr; wp->w_p_brisbr = bri_sbr;
return OK; return true;
} }

View File

@ -27,6 +27,7 @@ STARTTEST
: $put =g:line1 : $put =g:line1
: wincmd p : wincmd p
:endfu :endfu
:set briopt=min:0
:let g:test="Test 1: Simple breakindent" :let g:test="Test 1: Simple breakindent"
:let line1=ScreenChar(8) :let line1=ScreenChar(8)
:call DoRecordScreen() :call DoRecordScreen()

View File

@ -248,7 +248,7 @@ static int included_patches[] = {
//420 NA //420 NA
//419, //419,
418, 418,
//417, 417,
416, 416,
415, 415,
414, 414,