Skip to content

Commit dfede9a

Browse files
committed
patch 8.2.0146: wrong indent when 'showbreak' and 'breakindent' are set
Problem: Wrong indent when 'showbreak' and 'breakindent' are set and 'briopt' includes "sbr". Solution: Reset "need_showbreak" where needed. (Ken Takata, closes #5523)
1 parent 2c02d38 commit dfede9a

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/drawline.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,8 @@ win_line(
11761176
c_final = NUL;
11771177
n_extra = get_breakindent_win(wp,
11781178
ml_get_buf(wp->w_buffer, lnum, FALSE));
1179+
if (wp->w_skipcol > 0 && wp->w_p_wrap)
1180+
need_showbreak = FALSE;
11791181
// Correct end of highlighted area for 'breakindent',
11801182
// required when 'linebreak' is also set.
11811183
if (tocol == vcol)
@@ -1222,7 +1224,8 @@ win_line(
12221224
c_extra = NUL;
12231225
c_final = NUL;
12241226
n_extra = (int)STRLEN(sbr);
1225-
need_showbreak = FALSE;
1227+
if (wp->w_skipcol == 0 || !wp->w_p_wrap)
1228+
need_showbreak = FALSE;
12261229
vcol_sbr = vcol + MB_CHARLEN(sbr);
12271230
// Correct end of highlighted area for 'showbreak',
12281231
// required when 'linebreak' is also set.

src/testdir/test_breakindent.vim

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,29 @@ func Test_breakindent18_vartabs()
658658
call s:close_windows('set breakindent& list& listchars&')
659659
endfunc
660660

661+
func Test_breakindent19_sbr_nextpage()
662+
let s:input = ""
663+
call s:test_windows('setl breakindent briopt=shift:2,sbr,min:18 sbr=>')
664+
call setline(1, repeat('a', 200))
665+
norm! 1gg
666+
redraw!
667+
let lines = s:screen_lines(1, 20)
668+
let expect = [
669+
\ "aaaaaaaaaaaaaaaaaaaa",
670+
\ "> aaaaaaaaaaaaaaaaaa",
671+
\ "> aaaaaaaaaaaaaaaaaa",
672+
\ ]
673+
call s:compare_lines(expect, lines)
674+
" Scroll down one screen line
675+
setl scrolloff=5
676+
norm! 5gj
677+
redraw!
678+
let lines = s:screen_lines(1, 20)
679+
let expect = [
680+
\ "> aaaaaaaaaaaaaaaaaa",
681+
\ "> aaaaaaaaaaaaaaaaaa",
682+
\ "> aaaaaaaaaaaaaaaaaa",
683+
\ ]
684+
call s:compare_lines(expect, lines)
685+
call s:close_windows('set breakindent& briopt& sbr&')
686+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
146,
745747
/**/
746748
145,
747749
/**/

0 commit comments

Comments
 (0)