diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 13:11:50 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 16:23:08 +0800 |
commit | 8bed07357d5d1386dc9d969196e18ed2f291d068 (patch) | |
tree | 8791db192a1ee033b42ca3f157700a685303a8a6 | |
parent | cff02e993d920fa4bf0b5dc8b8f12d979850f049 (diff) | |
download | rneovim-8bed07357d5d1386dc9d969196e18ed2f291d068.tar.gz rneovim-8bed07357d5d1386dc9d969196e18ed2f291d068.tar.bz2 rneovim-8bed07357d5d1386dc9d969196e18ed2f291d068.zip |
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)
https://github.com/vim/vim/commit/aaa16b09180080284c4a5049fe16bdaccbb13b74
Cherry-pick test_conceal.vim changes from patches 8.2.4339, 9.0.0418.
Co-authored-by: Alexey Radkov <alexey.radkov@gmail.com>
-rw-r--r-- | src/nvim/drawline.c | 1 | ||||
-rw-r--r-- | test/old/testdir/test_conceal.vim | 45 |
2 files changed, 37 insertions, 9 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 2268a7cd3e..604af21899 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2947,6 +2947,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, } wlv.boguscols = 0; + wlv.vcol_off = 0; wlv.row++; // When not wrapping and finished diff lines, or when displayed diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim index bffc2f49d3..e3b8f767b8 100644 --- a/test/old/testdir/test_conceal.vim +++ b/test/old/testdir/test_conceal.vim @@ -24,7 +24,7 @@ func Test_conceal_two_windows() exe "normal /here\r" [CODE] - call writefile(code, 'XTest_conceal') + call writefile(code, 'XTest_conceal', 'D') " Check that cursor line is concealed let buf = RunVimInTerminal('-S XTest_conceal', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) @@ -106,7 +106,6 @@ func Test_conceal_two_windows() " clean up call StopVimInTerminal(buf) - call delete('XTest_conceal') endfunc func Test_conceal_with_cursorline() @@ -123,7 +122,7 @@ func Test_conceal_with_cursorline() normal M [CODE] - call writefile(code, 'XTest_conceal_cul') + call writefile(code, 'XTest_conceal_cul', 'D') let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) @@ -135,7 +134,38 @@ func Test_conceal_with_cursorline() " clean up 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 func Test_conceal_resize_term() @@ -147,17 +177,15 @@ func Test_conceal_resize_term() syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends normal fb [CODE] - call writefile(code, 'XTest_conceal_resize') + call writefile(code, 'XTest_conceal_resize', 'D') let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6}) call VerifyScreenDump(buf, 'Test_conceal_resize_01', {}) call win_execute(buf->win_findbuf()[0], 'wincmd +') - call TermWait(buf) call VerifyScreenDump(buf, 'Test_conceal_resize_02', {}) " clean up call StopVimInTerminal(buf) - call delete('XTest_conceal_resize') endfunc " Tests for correct display (cursor column position) with +conceal and @@ -245,7 +273,7 @@ func Test_conceal_cursor_pos() :q! [CODE] - call writefile(code, 'XTest_conceal_curpos') + call writefile(code, 'XTest_conceal_curpos', 'D') if RunVim([], [], '-s XTest_conceal_curpos') call assert_equal([ @@ -256,7 +284,6 @@ func Test_conceal_cursor_pos() endif call delete('Xconceal_curpos.out') - call delete('XTest_conceal_curpos') endfunc func Test_conceal_eol() |