vim-patch:9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing

Problem:    'cursorcolumn' and 'colorcolumn' wrong after concealing and
            wrapping line.
Solution:   Reset "wlv.vcol_off" after each screen line. (Alexey Radkov,
            closes vim/vim#11777)

aaa16b0918

Cherry-pick test_conceal.vim changes from patches 8.2.4339, 9.0.0418.

Co-authored-by: Alexey Radkov <alexey.radkov@gmail.com>
This commit is contained in:
zeertzjq 2023-04-19 13:11:50 +08:00
parent cff02e993d
commit 8bed07357d
2 changed files with 37 additions and 9 deletions

View File

@ -2947,6 +2947,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
} }
wlv.boguscols = 0; wlv.boguscols = 0;
wlv.vcol_off = 0;
wlv.row++; wlv.row++;
// When not wrapping and finished diff lines, or when displayed // When not wrapping and finished diff lines, or when displayed

View File

@ -24,7 +24,7 @@ func Test_conceal_two_windows()
exe "normal /here\r" exe "normal /here\r"
[CODE] [CODE]
call writefile(code, 'XTest_conceal') call writefile(code, 'XTest_conceal', 'D')
" Check that cursor line is concealed " Check that cursor line is concealed
let buf = RunVimInTerminal('-S XTest_conceal', {}) let buf = RunVimInTerminal('-S XTest_conceal', {})
call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
@ -106,7 +106,6 @@ func Test_conceal_two_windows()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal')
endfunc endfunc
func Test_conceal_with_cursorline() func Test_conceal_with_cursorline()
@ -123,7 +122,7 @@ func Test_conceal_with_cursorline()
normal M normal M
[CODE] [CODE]
call writefile(code, 'XTest_conceal_cul') call writefile(code, 'XTest_conceal_cul', 'D')
let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) let buf = RunVimInTerminal('-S XTest_conceal_cul', {})
call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {})
@ -135,7 +134,38 @@ func Test_conceal_with_cursorline()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal_cul') endfunc
func Test_conceal_with_cursorcolumn()
CheckScreendump
" Check that cursorcolumn and colorcolumn don't get broken in presence of
" wrapped lines containing concealed text
let code =<< trim [CODE]
let lines = ["one one one |hidden| one one one one one one one one",
\ "two two two two |hidden| here two two",
\ "three |hidden| three three three three three three three three"]
call setline(1, lines)
set wrap linebreak
set showbreak=\ >>>\
syntax match test /|hidden|/ conceal
set conceallevel=2
set concealcursor=
exe "normal /here\r"
set cursorcolumn
set colorcolumn=50
[CODE]
call writefile(code, 'XTest_conceal_cuc', 'D')
let buf = RunVimInTerminal('-S XTest_conceal_cuc', {'rows': 10, 'cols': 40})
call VerifyScreenDump(buf, 'Test_conceal_cuc_01', {})
" move cursor to the end of line (the cursor jumps to the next screen line)
call term_sendkeys(buf, "$")
call VerifyScreenDump(buf, 'Test_conceal_cuc_02', {})
" clean up
call StopVimInTerminal(buf)
endfunc endfunc
func Test_conceal_resize_term() func Test_conceal_resize_term()
@ -147,17 +177,15 @@ func Test_conceal_resize_term()
syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends
normal fb normal fb
[CODE] [CODE]
call writefile(code, 'XTest_conceal_resize') call writefile(code, 'XTest_conceal_resize', 'D')
let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6}) let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6})
call VerifyScreenDump(buf, 'Test_conceal_resize_01', {}) call VerifyScreenDump(buf, 'Test_conceal_resize_01', {})
call win_execute(buf->win_findbuf()[0], 'wincmd +') call win_execute(buf->win_findbuf()[0], 'wincmd +')
call TermWait(buf)
call VerifyScreenDump(buf, 'Test_conceal_resize_02', {}) call VerifyScreenDump(buf, 'Test_conceal_resize_02', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_conceal_resize')
endfunc endfunc
" Tests for correct display (cursor column position) with +conceal and " Tests for correct display (cursor column position) with +conceal and
@ -245,7 +273,7 @@ func Test_conceal_cursor_pos()
:q! :q!
[CODE] [CODE]
call writefile(code, 'XTest_conceal_curpos') call writefile(code, 'XTest_conceal_curpos', 'D')
if RunVim([], [], '-s XTest_conceal_curpos') if RunVim([], [], '-s XTest_conceal_curpos')
call assert_equal([ call assert_equal([
@ -256,7 +284,6 @@ func Test_conceal_cursor_pos()
endif endif
call delete('Xconceal_curpos.out') call delete('Xconceal_curpos.out')
call delete('XTest_conceal_curpos')
endfunc endfunc
func Test_conceal_eol() func Test_conceal_eol()