Skip to content

Commit

Permalink
Merge branch 'vim'
Browse files Browse the repository at this point in the history
Conflicts:
	src/option.c
  • Loading branch information
genoma committed Aug 25, 2014
2 parents a79c7ad + 934e177 commit 49025a7
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -3138,3 +3138,5 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411
121613e72e397db495f5e9b640b249aead5a61c1 v7-4-413
67edf731a2403a8023440184872159ddc073093c v7-4-414
20dbceb6f4713ccd01be45dc531abc269fbb7579 v7-4-415
735bd597a8ffcb00edff68b34a26573b8f3cad9a v7-4-416
e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417
5 changes: 1 addition & 4 deletions src/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,10 +1195,7 @@ win_lbr_chartabsize(wp, line, s, col, headp)
if (wp->w_p_bri)
added += get_breakindent_win(wp, line);

if (tab_corr)
size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts;
else
size += added;
size += added;
if (col != 0)
added = 0;
}
Expand Down
25 changes: 17 additions & 8 deletions src/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -3144,6 +3144,11 @@ static void fill_breakat_flags __ARGS((void));
static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
static int check_opt_strings __ARGS((char_u *val, char **values, int));
static int check_opt_wim __ARGS((void));

#ifdef FEAT_LINEBREAK
static int briopt_check __ARGS((win_T *wp));
#endif

#ifdef FEAT_FULLSCREEN
static int check_fuoptions __ARGS((char_u *, unsigned *, int *));
#endif
Expand Down Expand Up @@ -5361,7 +5366,7 @@ didset_options()
(void)check_cedit();
#endif
#ifdef FEAT_LINEBREAK
briopt_check();
briopt_check(curwin);
#endif
}

Expand Down Expand Up @@ -5820,7 +5825,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
/* 'breakindentopt' */
else if (varp == &curwin->w_p_briopt)
{
if (briopt_check() == FAIL)
if (briopt_check(curwin) == FAIL)
errmsg = e_invarg;
}
#endif
Expand Down Expand Up @@ -10373,6 +10378,9 @@ win_copy_options(wp_from, wp_to)
wp_to->w_farsi = wp_from->w_farsi;
# endif
# endif
#if defined(FEAT_LINEBREAK)
briopt_check(wp_to);
#endif
}
#endif

Expand Down Expand Up @@ -12238,15 +12246,16 @@ check_fuoptions(p_fuoptions, flags, bgcolor)
* This is called when 'breakindentopt' is changed and when a window is
* initialized.
*/
int
briopt_check()
static int
briopt_check(wp)
win_T *wp;
{
char_u *p;
int bri_shift = 0;
long bri_min = 20;
int bri_sbr = FALSE;

p = curwin->w_p_briopt;
p = wp->w_p_briopt;
while (*p != NUL)
{
if (STRNCMP(p, "shift:", 6) == 0
Expand All @@ -12271,9 +12280,9 @@ briopt_check()
++p;
}

curwin->w_p_brishift = bri_shift;
curwin->w_p_brimin = bri_min;
curwin->w_p_brisbr = bri_sbr;
wp->w_p_brishift = bri_shift;
wp->w_p_brimin = bri_min;
wp->w_p_brisbr = bri_sbr;

return OK;
}
Expand Down
1 change: 0 additions & 1 deletion src/proto/option.pro
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,4 @@ int check_ff_value __ARGS((char_u *p));
long get_sw_value __ARGS((buf_T *buf));
long get_sts_value __ARGS((void));
void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit));
int briopt_check __ARGS((void));
/* vim: set ft=c : */
18 changes: 18 additions & 0 deletions src/testdir/test_breakindent.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ STARTTEST
: $put =g:line1
: wincmd p
:endfu
:set briopt=min:0
:let g:test="Test 1: Simple breakindent"
:let line1=ScreenChar(8)
:call DoRecordScreen()
Expand Down Expand Up @@ -73,6 +74,23 @@ STARTTEST
:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
:$put =g:test
:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
:"
:" Test, that the string " a\tb\tc\td\te" is correctly
:" displayed in a 20 column wide window (see bug report
:" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ
:only
:vert 20new
:set all& nocp breakindent briopt=min:10
:call setline(1, [" a\tb\tc\td\te", " z y x w v"])
:/^\s*a
fbgjyl:let line1 = @0
:?^\s*z
fygjyl:let line2 = @0
:quit!
:$put ='Test 12: breakindent with wrapping Tab'
:$put =line1
:$put =line2
:"
:%w! test.out
:qa!
ENDTEST
Expand Down
3 changes: 3 additions & 0 deletions src/testdir/test_breakindent.ok
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ Test 4: Simple breakindent + min width: 18

Test 11: strdisplaywidth when breakindent is on
strdisplaywidth: 46 == calculated: 64
Test 12: breakindent with wrapping Tab
d
w
4 changes: 4 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
417,
/**/
416,
/**/
415,
/**/
Expand Down

0 comments on commit 49025a7

Please sign in to comment.