mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #1283 from splinterofchaos/breakindent-tab
vim-patch:7.4.416 + vim-patch:7.4.417
This commit is contained in:
commit
c5d7d75bb1
@ -1072,12 +1072,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he
|
||||
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;
|
||||
}
|
||||
|
||||
if (col != 0) {
|
||||
added = 0;
|
||||
}
|
||||
|
@ -3481,7 +3481,7 @@ static void didset_options(void)
|
||||
(void)compile_cap_prog(curwin->w_s);
|
||||
/* set cedit_key */
|
||||
(void)check_cedit();
|
||||
briopt_check();
|
||||
briopt_check(curwin);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3818,7 +3818,7 @@ did_set_string_option (
|
||||
}
|
||||
/* 'breakindentopt' */
|
||||
else if (varp == &curwin->w_p_briopt) {
|
||||
if (briopt_check() == FAIL)
|
||||
if (briopt_check(curwin) == FAIL)
|
||||
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);
|
||||
/* Is this right? */
|
||||
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
|
||||
initialized */
|
||||
int briopt_check(void)
|
||||
/// This is called when 'breakindentopt' is changed and when a window is
|
||||
/// initialized
|
||||
static bool briopt_check(win_T *wp)
|
||||
{
|
||||
char_u *p;
|
||||
int bri_shift = 0;
|
||||
long bri_min = 20;
|
||||
bool bri_sbr = false;
|
||||
|
||||
p = curwin->w_p_briopt;
|
||||
char_u *p = wp->w_p_briopt;
|
||||
while (*p != NUL)
|
||||
{
|
||||
if (STRNCMP(p, "shift:", 6) == 0
|
||||
@ -8172,15 +8172,15 @@ int briopt_check(void)
|
||||
bri_sbr = true;
|
||||
}
|
||||
if (*p != ',' && *p != NUL)
|
||||
return FAIL;
|
||||
return false;
|
||||
if (*p == ',')
|
||||
++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;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -248,8 +248,8 @@ static int included_patches[] = {
|
||||
//420 NA
|
||||
419,
|
||||
418,
|
||||
//417,
|
||||
//416,
|
||||
417,
|
||||
416,
|
||||
415,
|
||||
414,
|
||||
//413 NA
|
||||
|
Loading…
Reference in New Issue
Block a user