mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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)
This commit is contained in:
parent
2c02d3843a
commit
dfede9a70b
@ -1176,6 +1176,8 @@ win_line(
|
|||||||
c_final = NUL;
|
c_final = NUL;
|
||||||
n_extra = get_breakindent_win(wp,
|
n_extra = get_breakindent_win(wp,
|
||||||
ml_get_buf(wp->w_buffer, lnum, FALSE));
|
ml_get_buf(wp->w_buffer, lnum, FALSE));
|
||||||
|
if (wp->w_skipcol > 0 && wp->w_p_wrap)
|
||||||
|
need_showbreak = FALSE;
|
||||||
// Correct end of highlighted area for 'breakindent',
|
// Correct end of highlighted area for 'breakindent',
|
||||||
// required when 'linebreak' is also set.
|
// required when 'linebreak' is also set.
|
||||||
if (tocol == vcol)
|
if (tocol == vcol)
|
||||||
@ -1222,7 +1224,8 @@ win_line(
|
|||||||
c_extra = NUL;
|
c_extra = NUL;
|
||||||
c_final = NUL;
|
c_final = NUL;
|
||||||
n_extra = (int)STRLEN(sbr);
|
n_extra = (int)STRLEN(sbr);
|
||||||
need_showbreak = FALSE;
|
if (wp->w_skipcol == 0 || !wp->w_p_wrap)
|
||||||
|
need_showbreak = FALSE;
|
||||||
vcol_sbr = vcol + MB_CHARLEN(sbr);
|
vcol_sbr = vcol + MB_CHARLEN(sbr);
|
||||||
// Correct end of highlighted area for 'showbreak',
|
// Correct end of highlighted area for 'showbreak',
|
||||||
// required when 'linebreak' is also set.
|
// required when 'linebreak' is also set.
|
||||||
|
@ -658,3 +658,29 @@ func Test_breakindent18_vartabs()
|
|||||||
call s:close_windows('set breakindent& list& listchars&')
|
call s:close_windows('set breakindent& list& listchars&')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_breakindent19_sbr_nextpage()
|
||||||
|
let s:input = ""
|
||||||
|
call s:test_windows('setl breakindent briopt=shift:2,sbr,min:18 sbr=>')
|
||||||
|
call setline(1, repeat('a', 200))
|
||||||
|
norm! 1gg
|
||||||
|
redraw!
|
||||||
|
let lines = s:screen_lines(1, 20)
|
||||||
|
let expect = [
|
||||||
|
\ "aaaaaaaaaaaaaaaaaaaa",
|
||||||
|
\ "> aaaaaaaaaaaaaaaaaa",
|
||||||
|
\ "> aaaaaaaaaaaaaaaaaa",
|
||||||
|
\ ]
|
||||||
|
call s:compare_lines(expect, lines)
|
||||||
|
" Scroll down one screen line
|
||||||
|
setl scrolloff=5
|
||||||
|
norm! 5gj
|
||||||
|
redraw!
|
||||||
|
let lines = s:screen_lines(1, 20)
|
||||||
|
let expect = [
|
||||||
|
\ "> aaaaaaaaaaaaaaaaaa",
|
||||||
|
\ "> aaaaaaaaaaaaaaaaaa",
|
||||||
|
\ "> aaaaaaaaaaaaaaaaaa",
|
||||||
|
\ ]
|
||||||
|
call s:compare_lines(expect, lines)
|
||||||
|
call s:close_windows('set breakindent& briopt& sbr&')
|
||||||
|
endfunc
|
||||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
146,
|
||||||
/**/
|
/**/
|
||||||
145,
|
145,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user