aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-14 06:23:10 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-03-14 06:55:08 +0800
commit9599e5d28d31cfb0cb16e878f123b74283cca26b (patch)
tree01462ad3c7ce8a83c84161415f3fff4aa41fdd1c /test
parentb17be231a61f69b52eb809b6c72b20d3b089495d (diff)
downloadrneovim-9599e5d28d31cfb0cb16e878f123b74283cca26b.tar.gz
rneovim-9599e5d28d31cfb0cb16e878f123b74283cca26b.tar.bz2
rneovim-9599e5d28d31cfb0cb16e878f123b74283cca26b.zip
vim-patch:9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Problem: 'cursorline' and 'wincolor' highlight missing with concealed and wrapped lines. Solution: Apply 'cursorline' and 'wincolor' highlight to boguscols. (zeertzjq) Since 'cursorline' and 'wincolor' highlight apply after the end of the line, it is more consistent to have them also apply to boguscols. Assigning MAXCOL to values in ScreenCols[] make mouse click behave the same with 'cursorline' and 'nocursorline', but such behavior may be incorrect, as it puts the cursor on the next screen line. That may be fixed in a future PR. closes: vim/vim#14192 https://github.com/vim/vim/commit/21b0a3df8c4abb884489dfcc0c92b1bbe058f291
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/conceal_spec.lua62
-rw-r--r--test/old/testdir/test_conceal.vim51
2 files changed, 113 insertions, 0 deletions
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index 9a23d16c5b..a7badf6910 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -433,6 +433,68 @@ describe('Conceal', function()
]])
end)
+ -- oldtest: Test_conceal_wrapped_cursorline_wincolor()
+ it('CursorLine highlight on wrapped lines', function()
+ local screen = Screen.new(40, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
+ [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
+ })
+ screen:attach()
+ exec([[
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline
+ normal! g$
+ hi! CursorLine guibg=Green
+ ]])
+ screen:expect([[
+ {1:one one one one one one one on^e }|
+ {1: one one one }|
+ {0:~ }|
+ |
+ ]])
+ command('hi! CursorLine guibg=NONE guifg=Red')
+ screen:expect([[
+ {2:one one one one one one one on^e }|
+ {2: one one one }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft()
+ it('CursorLine highlight on wrapped lines with rightleft', function()
+ local screen = Screen.new(40, 4)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.Green }, -- CursorLine (low-priority)
+ [2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
+ })
+ screen:attach()
+ exec([[
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline rightleft
+ normal! g$
+ hi! CursorLine guibg=Green
+ ]])
+ screen:expect([[
+ {1: ^eno eno eno eno eno eno eno eno}|
+ {1: eno eno eno }|
+ {0: ~}|
+ |
+ ]])
+ command('hi! CursorLine guibg=NONE guifg=Red')
+ screen:expect([[
+ {2: ^eno eno eno eno eno eno eno eno}|
+ {2: eno eno eno }|
+ {0: ~}|
+ |
+ ]])
+ end)
+
-- oldtest: Test_conceal_resize_term()
it('resize editor', function()
local screen = Screen.new(75, 6)
diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim
index a679061544..d5a2bcce46 100644
--- a/test/old/testdir/test_conceal.vim
+++ b/test/old/testdir/test_conceal.vim
@@ -169,6 +169,57 @@ func Test_conceal_with_cursorcolumn()
call StopVimInTerminal(buf)
endfunc
+" Check that 'cursorline' and 'wincolor' apply to the whole line in presence
+" of wrapped lines containing concealed text.
+func Test_conceal_wrapped_cursorline_wincolor()
+ CheckScreendump
+
+ let code =<< trim [CODE]
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline
+ normal! g$
+ [CODE]
+
+ call writefile(code, 'XTest_conceal_cul_wcr', 'D')
+ let buf = RunVimInTerminal('-S XTest_conceal_cul_wcr', {'rows': 4, 'cols': 40})
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_01', {})
+
+ call term_sendkeys(buf, ":set wincolor=ErrorMsg\n")
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_02', {})
+
+ call term_sendkeys(buf, ":set nocursorline\n")
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_03', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
+" Same as Test_conceal_wrapped_cursorline_wincolor(), but with 'rightleft'.
+func Test_conceal_wrapped_cursorline_wincolor_rightleft()
+ CheckScreendump
+
+ let code =<< trim [CODE]
+ call setline(1, 'one one one |hidden| one one one one one one one one')
+ syntax match test /|hidden|/ conceal
+ set conceallevel=2 concealcursor=n cursorline rightleft
+ normal! g$
+ [CODE]
+
+ call writefile(code, 'XTest_conceal_cul_wcr_rl', 'D')
+ let buf = RunVimInTerminal('-S XTest_conceal_cul_wcr_rl', {'rows': 4, 'cols': 40})
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_01', {})
+
+ call term_sendkeys(buf, ":set wincolor=ErrorMsg\n")
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_02', {})
+
+ call term_sendkeys(buf, ":set nocursorline\n")
+ call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_03', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_conceal_resize_term()
CheckScreendump