aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/conceal_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-11-09 13:48:45 +0100
committerGitHub <noreply@github.com>2024-11-09 13:48:45 +0100
commitdd4c828c86d0da7823a1c415d0e9c1d493e901b7 (patch)
treea50e1acc9853288d484f135acc50c066521a1b22 /test/functional/legacy/conceal_spec.lua
parent07b14c8e2ed288dfca382719aeb26d544573f51a (diff)
parentabe6a07c54c0e927cf43f7f61b05ac91547daeed (diff)
downloadrneovim-dd4c828c86d0da7823a1c415d0e9c1d493e901b7.tar.gz
rneovim-dd4c828c86d0da7823a1c415d0e9c1d493e901b7.tar.bz2
rneovim-dd4c828c86d0da7823a1c415d0e9c1d493e901b7.zip
Merge pull request #31118 from bfredl/merehl
refactor(tests): continue the global highlight definition work
Diffstat (limited to 'test/functional/legacy/conceal_spec.lua')
-rw-r--r--test/functional/legacy/conceal_spec.lua146
1 files changed, 65 insertions, 81 deletions
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index f4c1983bb7..5bd8944247 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -382,11 +382,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_with_cursorcolumn()
it('CursorColumn and ColorColumn on wrapped line', function()
local screen = Screen.new(40, 10)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { background = Screen.colors.Grey90 }, -- CursorColumn
- [2] = { background = Screen.colors.LightRed }, -- ColorColumn
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.LightRed },
+ }
screen:attach()
-- Check that cursorcolumn and colorcolumn don't get broken in presence of
-- wrapped lines containing concealed text
@@ -408,12 +406,12 @@ describe('Conceal', function()
-- luacheck: pop
screen:expect([[
- one one one one one one {1:o}ne |
- {0: >>> }one {2:o}ne one one |
+ one one one one one one {21:o}ne |
+ {1: >>> }one {100:o}ne one one |
two two two two |hidden| ^here two two |
- three three three three {1:t}hree |
- {0: >>> }thre{2:e} three three three |
- {0:~ }|*4
+ three three three three {21:t}hree |
+ {1: >>> }thre{100:e} three three three |
+ {1:~ }|*4
/here |
]])
@@ -421,11 +419,11 @@ describe('Conceal', function()
feed('$')
screen:expect([[
one one one one one one one |
- {0: >>> }one {2:o}ne one one |
+ {1: >>> }one {100:o}ne one one |
two two two two |hidden| here two tw^o |
three three three three three |
- {0: >>> }thre{2:e} three three three |
- {0:~ }|*4
+ {1: >>> }thre{100:e} three three three |
+ {1:~ }|*4
/here |
]])
end)
@@ -433,11 +431,9 @@ describe('Conceal', function()
-- 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:add_extra_attr_ids {
+ [100] = { background = Screen.colors.WebGreen },
+ }
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
@@ -447,16 +443,16 @@ describe('Conceal', function()
hi! CursorLine guibg=Green
]])
screen:expect([[
- {1:one one one one one one one on^e }|
- {1: one one one }|
- {0:~ }|
+ {100:one one one one one one one on^e }|
+ {100: one one one }|
+ {1:~ }|
|
]])
command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[
- {2:one one one one one one one on^e }|
- {2: one one one }|
- {0:~ }|
+ {19:one one one one one one one on^e }|
+ {19: one one one }|
+ {1:~ }|
|
]])
end)
@@ -464,11 +460,9 @@ describe('Conceal', function()
-- 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:add_extra_attr_ids {
+ [100] = { background = Screen.colors.WebGreen },
+ }
screen:attach()
exec([[
call setline(1, 'one one one |hidden| one one one one one one one one')
@@ -478,16 +472,16 @@ describe('Conceal', function()
hi! CursorLine guibg=Green
]])
screen:expect([[
- {1: ^eno eno eno eno eno eno eno eno}|
- {1: eno eno eno }|
- {0: ~}|
+ {100: ^eno eno eno eno eno eno eno eno}|
+ {100: eno eno eno }|
+ {1: ~}|
|
]])
command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[
- {2: ^eno eno eno eno eno eno eno eno}|
- {2: eno eno eno }|
- {0: ~}|
+ {19: ^eno eno eno eno eno eno eno eno}|
+ {19: eno eno eno }|
+ {1: ~}|
|
]])
end)
@@ -625,9 +619,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol(wrap)
local screen = Screen.new(60, 3)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- })
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@@ -638,31 +629,31 @@ describe('Conceal', function()
]])
screen:expect([[
abcdefghijklmnpo^p |
- {0:~ }|
+ {1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop^ |
- {0:~ }|
+ {1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
- {0:~ }|
+ {1:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
- {0:~ }|
+ {1:~ }|
|
]])
feed('rr')
screen:expect([[
abcdefghijklmnpop ^r |
- {0:~ }|
+ {1:~ }|
|
]])
end
@@ -679,9 +670,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol_rightleft(wrap)
local screen = Screen.new(60, 3)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- })
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@@ -692,31 +680,31 @@ describe('Conceal', function()
]])
screen:expect([[
^popnmlkjihgfedcba|
- {0: ~}|
+ {1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
- {0: ~}|
+ {1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
- {0: ~}|
+ {1: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
- {0: ~}|
+ {1: ~}|
|
]])
feed('rr')
screen:expect([[
^r popnmlkjihgfedcba|
- {0: ~}|
+ {1: ~}|
|
]])
end
@@ -733,11 +721,9 @@ describe('Conceal', function()
local function test_conceal_double_width(wrap)
local screen = Screen.new(60, 4)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
- [2] = { background = Screen.colors.LightRed },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.LightRed },
+ }
screen:attach()
api.nvim_set_option_value('wrap', wrap, {})
exec([[
@@ -747,30 +733,30 @@ describe('Conceal', function()
normal! $
]])
screen:expect([[
- aaaaa{1:β}bbbbb{1:β}cccc^c {2: } |
- foobar {2: } |
- {0:~ }|
+ aaaaa{14:β}bbbbb{14:β}cccc^c {100: } |
+ foobar {100: } |
+ {1:~ }|
|
]])
feed('gM')
screen:expect([[
- aaaaa{1:β}bb^bbb{1:β}ccccc {2: } |
- foobar {2: } |
- {0:~ }|
+ aaaaa{14:β}bb^bbb{14:β}ccccc {100: } |
+ foobar {100: } |
+ {1:~ }|
|
]])
command('set conceallevel=3')
screen:expect([[
- aaaaabb^bbbccccc {2: } |
- foobar {2: } |
- {0:~ }|
+ aaaaabb^bbbccccc {100: } |
+ foobar {100: } |
+ {1:~ }|
|
]])
feed('$')
screen:expect([[
- aaaaabbbbbcccc^c {2: } |
- foobar {2: } |
- {0:~ }|
+ aaaaabbbbbcccc^c {100: } |
+ foobar {100: } |
+ {1:~ }|
|
]])
end
@@ -788,11 +774,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_double_width_wrap()
it('line wraps correctly when double-width chars are concealed', function()
local screen = Screen.new(20, 4)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
- [2] = { background = Screen.colors.LightRed },
- })
+ screen:add_extra_attr_ids {
+ [100] = { background = Screen.colors.LightRed },
+ }
screen:attach()
exec([[
call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
@@ -801,30 +785,30 @@ describe('Conceal', function()
normal! $
]])
screen:expect([[
- aaaaaaaaaa{1:β}bbbbb |
- bbbbb{1:β}ccccccccc^c |
- {0:~ }|
+ aaaaaaaaaa{14:β}bbbbb |
+ bbbbb{14:β}ccccccccc^c |
+ {1:~ }|
|
]])
feed('gM')
screen:expect([[
- aaaaaaaaaa{1:β}bbbbb |
- ^bbbbb{1:β}cccccccccc |
- {0:~ }|
+ aaaaaaaaaa{14:β}bbbbb |
+ ^bbbbb{14:β}cccccccccc |
+ {1:~ }|
|
]])
command('set conceallevel=3')
screen:expect([[
aaaaaaaaaabbbbb |
^bbbbbcccccccccc |
- {0:~ }|
+ {1:~ }|
|
]])
feed('$')
screen:expect([[
aaaaaaaaaabbbbb |
bbbbbccccccccc^c |
- {0:~ }|
+ {1:~ }|
|
]])
end)