Merge pull request #31118 from bfredl/merehl

refactor(tests): continue the global highlight definition work
This commit is contained in:
bfredl 2024-11-09 13:48:45 +01:00 committed by GitHub
commit dd4c828c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 206 additions and 254 deletions

View File

@ -382,11 +382,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_with_cursorcolumn() -- oldtest: Test_conceal_with_cursorcolumn()
it('CursorColumn and ColorColumn on wrapped line', function() it('CursorColumn and ColorColumn on wrapped line', function()
local screen = Screen.new(40, 10) local screen = Screen.new(40, 10)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText [100] = { background = Screen.colors.LightRed },
[1] = { background = Screen.colors.Grey90 }, -- CursorColumn }
[2] = { background = Screen.colors.LightRed }, -- ColorColumn
})
screen:attach() screen:attach()
-- Check that cursorcolumn and colorcolumn don't get broken in presence of -- Check that cursorcolumn and colorcolumn don't get broken in presence of
-- wrapped lines containing concealed text -- wrapped lines containing concealed text
@ -408,12 +406,12 @@ describe('Conceal', function()
-- luacheck: pop -- luacheck: pop
screen:expect([[ screen:expect([[
one one one one one one {1:o}ne | one one one one one one {21:o}ne |
{0: >>> }one {2:o}ne one one | {1: >>> }one {100:o}ne one one |
two two two two |hidden| ^here two two | two two two two |hidden| ^here two two |
three three three three {1:t}hree | three three three three {21:t}hree |
{0: >>> }thre{2:e} three three three | {1: >>> }thre{100:e} three three three |
{0:~ }|*4 {1:~ }|*4
/here | /here |
]]) ]])
@ -421,11 +419,11 @@ describe('Conceal', function()
feed('$') feed('$')
screen:expect([[ screen:expect([[
one one one one one one one | 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 | two two two two |hidden| here two tw^o |
three three three three three | three three three three three |
{0: >>> }thre{2:e} three three three | {1: >>> }thre{100:e} three three three |
{0:~ }|*4 {1:~ }|*4
/here | /here |
]]) ]])
end) end)
@ -433,11 +431,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_wrapped_cursorline_wincolor() -- oldtest: Test_conceal_wrapped_cursorline_wincolor()
it('CursorLine highlight on wrapped lines', function() it('CursorLine highlight on wrapped lines', function()
local screen = Screen.new(40, 4) local screen = Screen.new(40, 4)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText [100] = { background = Screen.colors.WebGreen },
[1] = { background = Screen.colors.Green }, -- CursorLine (low-priority) }
[2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, 'one one one |hidden| one one one one one one one one') 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 hi! CursorLine guibg=Green
]]) ]])
screen:expect([[ screen:expect([[
{1:one one one one one one one on^e }| {100:one one one one one one one on^e }|
{1: one one one }| {100: one one one }|
{0:~ }| {1:~ }|
| |
]]) ]])
command('hi! CursorLine guibg=NONE guifg=Red') command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[ screen:expect([[
{2:one one one one one one one on^e }| {19:one one one one one one one on^e }|
{2: one one one }| {19: one one one }|
{0:~ }| {1:~ }|
| |
]]) ]])
end) end)
@ -464,11 +460,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft() -- oldtest: Test_conceal_wrapped_cursorline_wincolor_rightleft()
it('CursorLine highlight on wrapped lines with rightleft', function() it('CursorLine highlight on wrapped lines with rightleft', function()
local screen = Screen.new(40, 4) local screen = Screen.new(40, 4)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText [100] = { background = Screen.colors.WebGreen },
[1] = { background = Screen.colors.Green }, -- CursorLine (low-priority) }
[2] = { foreground = Screen.colors.Red }, -- CursorLine (high-priority)
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, 'one one one |hidden| one one one one one one one one') 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 hi! CursorLine guibg=Green
]]) ]])
screen:expect([[ screen:expect([[
{1: ^eno eno eno eno eno eno eno eno}| {100: ^eno eno eno eno eno eno eno eno}|
{1: eno eno eno }| {100: eno eno eno }|
{0: ~}| {1: ~}|
| |
]]) ]])
command('hi! CursorLine guibg=NONE guifg=Red') command('hi! CursorLine guibg=NONE guifg=Red')
screen:expect([[ screen:expect([[
{2: ^eno eno eno eno eno eno eno eno}| {19: ^eno eno eno eno eno eno eno eno}|
{2: eno eno eno }| {19: eno eno eno }|
{0: ~}| {1: ~}|
| |
]]) ]])
end) end)
@ -625,9 +619,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol(wrap) local function test_conceal_virtualedit_after_eol(wrap)
local screen = Screen.new(60, 3) local screen = Screen.new(60, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
api.nvim_set_option_value('wrap', wrap, {}) api.nvim_set_option_value('wrap', wrap, {})
exec([[ exec([[
@ -638,31 +629,31 @@ describe('Conceal', function()
]]) ]])
screen:expect([[ screen:expect([[
abcdefghijklmnpo^p | abcdefghijklmnpo^p |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('l') feed('l')
screen:expect([[ screen:expect([[
abcdefghijklmnpop^ | abcdefghijklmnpop^ |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('l') feed('l')
screen:expect([[ screen:expect([[
abcdefghijklmnpop ^ | abcdefghijklmnpop ^ |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('l') feed('l')
screen:expect([[ screen:expect([[
abcdefghijklmnpop ^ | abcdefghijklmnpop ^ |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('rr') feed('rr')
screen:expect([[ screen:expect([[
abcdefghijklmnpop ^r | abcdefghijklmnpop ^r |
{0:~ }| {1:~ }|
| |
]]) ]])
end end
@ -679,9 +670,6 @@ describe('Conceal', function()
local function test_conceal_virtualedit_after_eol_rightleft(wrap) local function test_conceal_virtualedit_after_eol_rightleft(wrap)
local screen = Screen.new(60, 3) local screen = Screen.new(60, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
api.nvim_set_option_value('wrap', wrap, {}) api.nvim_set_option_value('wrap', wrap, {})
exec([[ exec([[
@ -692,31 +680,31 @@ describe('Conceal', function()
]]) ]])
screen:expect([[ screen:expect([[
^popnmlkjihgfedcba| ^popnmlkjihgfedcba|
{0: ~}| {1: ~}|
| |
]]) ]])
feed('h') feed('h')
screen:expect([[ screen:expect([[
^ popnmlkjihgfedcba| ^ popnmlkjihgfedcba|
{0: ~}| {1: ~}|
| |
]]) ]])
feed('h') feed('h')
screen:expect([[ screen:expect([[
^ popnmlkjihgfedcba| ^ popnmlkjihgfedcba|
{0: ~}| {1: ~}|
| |
]]) ]])
feed('h') feed('h')
screen:expect([[ screen:expect([[
^ popnmlkjihgfedcba| ^ popnmlkjihgfedcba|
{0: ~}| {1: ~}|
| |
]]) ]])
feed('rr') feed('rr')
screen:expect([[ screen:expect([[
^r popnmlkjihgfedcba| ^r popnmlkjihgfedcba|
{0: ~}| {1: ~}|
| |
]]) ]])
end end
@ -733,11 +721,9 @@ describe('Conceal', function()
local function test_conceal_double_width(wrap) local function test_conceal_double_width(wrap)
local screen = Screen.new(60, 4) local screen = Screen.new(60, 4)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, [100] = { background = Screen.colors.LightRed },
[1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey }, }
[2] = { background = Screen.colors.LightRed },
})
screen:attach() screen:attach()
api.nvim_set_option_value('wrap', wrap, {}) api.nvim_set_option_value('wrap', wrap, {})
exec([[ exec([[
@ -747,30 +733,30 @@ describe('Conceal', function()
normal! $ normal! $
]]) ]])
screen:expect([[ screen:expect([[
aaaaa{1:β}bbbbb{1:β}cccc^c {2: } | aaaaa{14:β}bbbbb{14:β}cccc^c {100: } |
foobar {2: } | foobar {100: } |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('gM') feed('gM')
screen:expect([[ screen:expect([[
aaaaa{1:β}bb^bbb{1:β}ccccc {2: } | aaaaa{14:β}bb^bbb{14:β}ccccc {100: } |
foobar {2: } | foobar {100: } |
{0:~ }| {1:~ }|
| |
]]) ]])
command('set conceallevel=3') command('set conceallevel=3')
screen:expect([[ screen:expect([[
aaaaabb^bbbccccc {2: } | aaaaabb^bbbccccc {100: } |
foobar {2: } | foobar {100: } |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('$') feed('$')
screen:expect([[ screen:expect([[
aaaaabbbbbcccc^c {2: } | aaaaabbbbbcccc^c {100: } |
foobar {2: } | foobar {100: } |
{0:~ }| {1:~ }|
| |
]]) ]])
end end
@ -788,11 +774,9 @@ describe('Conceal', function()
-- oldtest: Test_conceal_double_width_wrap() -- oldtest: Test_conceal_double_width_wrap()
it('line wraps correctly when double-width chars are concealed', function() it('line wraps correctly when double-width chars are concealed', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, [100] = { background = Screen.colors.LightRed },
[1] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey }, }
[2] = { background = Screen.colors.LightRed },
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc') call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
@ -801,30 +785,30 @@ describe('Conceal', function()
normal! $ normal! $
]]) ]])
screen:expect([[ screen:expect([[
aaaaaaaaaa{1:β}bbbbb | aaaaaaaaaa{14:β}bbbbb |
bbbbb{1:β}ccccccccc^c | bbbbb{14:β}ccccccccc^c |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('gM') feed('gM')
screen:expect([[ screen:expect([[
aaaaaaaaaa{1:β}bbbbb | aaaaaaaaaa{14:β}bbbbb |
^bbbbb{1:β}cccccccccc | ^bbbbb{14:β}cccccccccc |
{0:~ }| {1:~ }|
| |
]]) ]])
command('set conceallevel=3') command('set conceallevel=3')
screen:expect([[ screen:expect([[
aaaaaaaaaabbbbb | aaaaaaaaaabbbbb |
^bbbbbcccccccccc | ^bbbbbcccccccccc |
{0:~ }| {1:~ }|
| |
]]) ]])
feed('$') feed('$')
screen:expect([[ screen:expect([[
aaaaaaaaaabbbbb | aaaaaaaaaabbbbb |
bbbbbccccccccc^c | bbbbbccccccccc^c |
{0:~ }| {1:~ }|
| |
]]) ]])
end) end)

View File

@ -34,20 +34,19 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_clear_highlight() -- oldtest: Test_matchparen_clear_highlight()
it('matchparen highlight is cleared when switching buffer', function() it('matchparen highlight is cleared when switching buffer', function()
local screen = Screen.new(20, 5) local screen = Screen.new(20, 5)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, [100] = { background = Screen.colors.Cyan1 },
[1] = { background = Screen.colors.Cyan }, }
})
screen:attach() screen:attach()
local screen1 = [[ local screen1 = [[
{1:^()} | {100:^()} |
{0:~ }|*3 {1:~ }|*3
| |
]] ]]
local screen2 = [[ local screen2 = [[
^aa | ^aa |
{0:~ }|*3 {1:~ }|*3
| |
]] ]]
@ -77,11 +76,9 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_win_execute() -- oldtest: Test_matchparen_win_execute()
it('matchparen highlight when switching buffer in win_execute()', function() it('matchparen highlight when switching buffer in win_execute()', function()
local screen = Screen.new(20, 5) local screen = Screen.new(20, 5)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { background = Screen.colors.Cyan }, [100] = { background = Screen.colors.Cyan1 },
[2] = { reverse = true, bold = true }, }
[3] = { reverse = true },
})
screen:attach() screen:attach()
exec([[ exec([[
@ -95,10 +92,10 @@ describe('matchparen', function()
endfunc endfunc
]]) ]])
screen:expect([[ screen:expect([[
{1:^{}} | {100:^{}} |
{2:[No Name] [+] }|
{} |
{3:[No Name] [+] }| {3:[No Name] [+] }|
{} |
{2:[No Name] [+] }|
| |
]]) ]])
@ -136,11 +133,9 @@ describe('matchparen', function()
-- oldtest: Test_matchparen_mbyte() -- oldtest: Test_matchparen_mbyte()
it("works with multibyte chars in 'matchpairs'", function() it("works with multibyte chars in 'matchpairs'", function()
local screen = Screen.new(30, 10) local screen = Screen.new(30, 10)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, [100] = { background = Screen.colors.Cyan1 },
[1] = { background = Screen.colors.Cyan }, }
[2] = { bold = true },
})
screen:attach() screen:attach()
exec([[ exec([[
@ -152,57 +147,57 @@ describe('matchparen', function()
screen:expect([[ screen:expect([[
^aaaaaaaa | ^aaaaaaaa |
bbbbcc | bbbbcc |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
feed('$') feed('$')
screen:expect([[ screen:expect([[
aaaaaaaa{1:^} | aaaaaaaa{100:^} |
bbbb{1:}cc | bbbb{100:}cc |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
feed('j') feed('j')
screen:expect([[ screen:expect([[
aaaaaaaa | aaaaaaaa |
bbbbc^c | bbbbc^c |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
feed('2h') feed('2h')
screen:expect([[ screen:expect([[
aaaaaaaa{1:} | aaaaaaaa{100:} |
bbbb{1:^}cc | bbbb{100:^}cc |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
feed('0') feed('0')
screen:expect([[ screen:expect([[
aaaaaaaa | aaaaaaaa |
^bbbbcc | ^bbbbcc |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
feed('kA') feed('kA')
screen:expect([[ screen:expect([[
aaaaaaaa{1:}^ | aaaaaaaa{100:}^ |
bbbb{1:}cc | bbbb{100:}cc |
{0:~ }|*7 {1:~ }|*7
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Down>') feed('<Down>')
screen:expect([[ screen:expect([[
aaaaaaaa | aaaaaaaa |
bbbbcc^ | bbbbcc^ |
{0:~ }|*7 {1:~ }|*7
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<C-W>') feed('<C-W>')
screen:expect([[ screen:expect([[
aaaaaaaa{1:} | aaaaaaaa{100:} |
bbbb{1:}^ | bbbb{100:}^ |
{0:~ }|*7 {1:~ }|*7
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
end) end)

View File

@ -21,16 +21,6 @@ describe('ui/ext_popupmenu', function()
clear() clear()
screen = Screen.new(60, 8) screen = Screen.new(60, 8)
screen:attach({ rgb = true, ext_popupmenu = true }) screen:attach({ rgb = true, ext_popupmenu = true })
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { bold = true },
[3] = { reverse = true },
[4] = { bold = true, reverse = true },
[5] = { bold = true, foreground = Screen.colors.SeaGreen },
[6] = { background = Screen.colors.WebGray },
[7] = { background = Screen.colors.LightMagenta },
[8] = { foreground = Screen.colors.Red },
})
source([[ source([[
function! TestComplete() abort function! TestComplete() abort
call complete(1, [{'word':'foo', 'abbr':'fo', 'menu':'the foo', 'info':'foo-y', 'kind':'x'}, 'bar', 'spam']) call complete(1, [{'word':'foo', 'abbr':'fo', 'menu':'the foo', 'info':'foo-y', 'kind':'x'}, 'bar', 'spam'])
@ -52,7 +42,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -67,7 +57,7 @@ describe('ui/ext_popupmenu', function()
| |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -83,7 +73,7 @@ describe('ui/ext_popupmenu', function()
| |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -98,7 +88,7 @@ describe('ui/ext_popupmenu', function()
| |
bar^ | bar^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
} }
end) end)
@ -110,7 +100,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -125,7 +115,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -140,7 +130,7 @@ describe('ui/ext_popupmenu', function()
| |
spam^ | spam^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -154,7 +144,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<c-w><C-r>=TestComplete()<CR>') feed('<c-w><C-r>=TestComplete()<CR>')
@ -163,7 +153,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -178,7 +168,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -193,7 +183,7 @@ describe('ui/ext_popupmenu', function()
| |
bar^ | bar^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -208,7 +198,7 @@ describe('ui/ext_popupmenu', function()
| |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -223,7 +213,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -237,7 +227,7 @@ describe('ui/ext_popupmenu', function()
| |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
command('set wildmenu') command('set wildmenu')
@ -332,7 +322,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -347,7 +337,7 @@ describe('ui/ext_popupmenu', function()
| |
spam^ | spam^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -362,7 +352,7 @@ describe('ui/ext_popupmenu', function()
| |
spam^ | spam^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -376,7 +366,7 @@ describe('ui/ext_popupmenu', function()
| |
bar^ | bar^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>:sign <Tab>') feed('<Esc>:sign <Tab>')
@ -440,33 +430,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[ screen:expect([[
| |
foo^ | foo^ |
{6:fo x the foo }{1: }| {12:fo x the foo }{1: }|
{7:bar }{1: }| {4:bar }{1: }|
{7:spam }{1: }| {4:spam }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<f1>') feed('<f1>')
screen:expect([[ screen:expect([[
| |
spam^ | spam^ |
{7:fo x the foo }{1: }| {4:fo x the foo }{1: }|
{7:bar }{1: }| {4:bar }{1: }|
{6:spam }{1: }| {12:spam }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<f2>') feed('<f2>')
screen:expect([[ screen:expect([[
| |
spam^ | spam^ |
{7:fo x the foo }{1: }| {4:fo x the foo }{1: }|
{7:bar }{1: }| {4:bar }{1: }|
{7:spam }{1: }| {4:spam }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<f3>') feed('<f3>')
@ -474,42 +464,42 @@ describe('ui/ext_popupmenu', function()
| |
bar^ | bar^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>:sign <Tab>') feed('<Esc>:sign <Tab>')
screen:expect([[ screen:expect([[
| |
bar {6: define } | bar {12: define } |
{1:~ }{7: jump }{1: }| {1:~ }{4: jump }{1: }|
{1:~ }{7: list }{1: }| {1:~ }{4: list }{1: }|
{1:~ }{7: place }{1: }| {1:~ }{4: place }{1: }|
{1:~ }{7: undefine }{1: }| {1:~ }{4: undefine }{1: }|
{1:~ }{7: unplace }{1: }| {1:~ }{4: unplace }{1: }|
:sign define^ | :sign define^ |
]]) ]])
feed('<f1>') feed('<f1>')
screen:expect([[ screen:expect([[
| |
bar {7: define } | bar {4: define } |
{1:~ }{7: jump }{1: }| {1:~ }{4: jump }{1: }|
{1:~ }{6: list }{1: }| {1:~ }{12: list }{1: }|
{1:~ }{7: place }{1: }| {1:~ }{4: place }{1: }|
{1:~ }{7: undefine }{1: }| {1:~ }{4: undefine }{1: }|
{1:~ }{7: unplace }{1: }| {1:~ }{4: unplace }{1: }|
:sign list^ | :sign list^ |
]]) ]])
feed('<f2>') feed('<f2>')
screen:expect([[ screen:expect([[
| |
bar {7: define } | bar {4: define } |
{1:~ }{7: jump }{1: }| {1:~ }{4: jump }{1: }|
{1:~ }{7: list }{1: }| {1:~ }{4: list }{1: }|
{1:~ }{7: place }{1: }| {1:~ }{4: place }{1: }|
{1:~ }{7: undefine }{1: }| {1:~ }{4: undefine }{1: }|
{1:~ }{7: unplace }{1: }| {1:~ }{4: unplace }{1: }|
:sign ^ | :sign ^ |
]]) ]])
@ -542,33 +532,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[ screen:expect([[
aa bb cc | aa bb cc |
aa^ | aa^ |
{6:aa }{1: }| {12:aa }{1: }|
{7:bb }{1: }| {4:bb }{1: }|
{7:cc }{1: }| {4:cc }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 3} | {5:-- Keyword Local completion (^N^P) }{6:match 1 of 3} |
]]) ]])
feed('<f1>') feed('<f1>')
screen:expect([[ screen:expect([[
aa bb cc | aa bb cc |
cc^ | cc^ |
{7:aa }{1: }| {4:aa }{1: }|
{7:bb }{1: }| {4:bb }{1: }|
{6:cc }{1: }| {12:cc }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{5:match 3 of 3} | {5:-- Keyword Local completion (^N^P) }{6:match 3 of 3} |
]]) ]])
feed('<f2>') feed('<f2>')
screen:expect([[ screen:expect([[
aa bb cc | aa bb cc |
cc^ | cc^ |
{7:aa }{1: }| {4:aa }{1: }|
{7:bb }{1: }| {4:bb }{1: }|
{7:cc }{1: }| {4:cc }{1: }|
{1:~ }|*2 {1:~ }|*2
{2:-- Keyword Local completion (^N^P) }{8:Back at original} | {5:-- Keyword Local completion (^N^P) }{19:Back at original} |
]]) ]])
feed('<f3>') feed('<f3>')
@ -576,7 +566,7 @@ describe('ui/ext_popupmenu', function()
aa bb cc | aa bb cc |
bb^ | bb^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
@ -619,7 +609,7 @@ describe('ui/ext_popupmenu', function()
| |
January^ | January^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = month_expected, items = month_expected,
@ -671,7 +661,7 @@ describe('ui/ext_popupmenu', function()
| |
January^ | January^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = month_expected, items = month_expected,
@ -726,7 +716,7 @@ describe('ui/ext_popupmenu', function()
| |
January^ | January^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = month_expected, items = month_expected,
@ -740,7 +730,7 @@ describe('ui/ext_popupmenu', function()
| |
January^ | January^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = month_expected, items = month_expected,
@ -832,10 +822,10 @@ describe('ui/ext_popupmenu', function()
grid = [[ grid = [[
| |
{1:~ }|*3 {1:~ }|*3
{4:långfile2 }| {3:långfile2 }|
| |
{1:~ }|*2 {1:~ }|*2
{3:långfile1 }| {2:långfile1 }|
:b långfile1^ | :b långfile1^ |
]], ]],
popupmenu = { popupmenu = {
@ -863,7 +853,7 @@ describe('ui/ext_popupmenu', function()
| |
foo^ | foo^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -878,7 +868,7 @@ describe('ui/ext_popupmenu', function()
| |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
popupmenu = { popupmenu = {
items = expected, items = expected,
@ -899,9 +889,9 @@ describe('ui/ext_popupmenu', function()
feed('<RightMouse><0,0>') feed('<RightMouse><0,0>')
screen:expect([[ screen:expect([[
| |
{7:^foo } | {4:^foo } |
{7:bar }{1: }| {4:bar }{1: }|
{7:baz }{1: }| {4:baz }{1: }|
{1:~ }|*3 {1:~ }|*3
| |
]]) ]])
@ -3640,37 +3630,36 @@ describe('builtin popupmenu', function()
it( it(
'cascading highlights for matched text (PmenuMatch, PmenuMatchSel) in cmdline pum', 'cascading highlights for matched text (PmenuMatch, PmenuMatchSel) in cmdline pum',
function() function()
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { foreground = Screen.colors.Blue1, bold = true }, [100] = {
[2] = { background = Screen.colors.Grey,
underline = true,
italic = true, italic = true,
underline = true,
foreground = Screen.colors.White, foreground = Screen.colors.White,
background = Screen.colors.Grey,
}, },
[3] = { [101] = {
foreground = Screen.colors.Red,
background = Screen.colors.Grey,
strikethrough = true, strikethrough = true,
underline = true, foreground = Screen.colors.Grey0,
italic = true, italic = true,
},
[4] = {
foreground = Screen.colors.Yellow,
background = Screen.colors.Pink,
bold = true, bold = true,
underline = true, underline = true,
italic = true,
},
[5] = {
foreground = Screen.colors.Black,
background = Screen.colors.White, background = Screen.colors.White,
},
[102] = {
strikethrough = true,
foreground = Screen.colors.Red,
italic = true,
underline = true,
background = Screen.colors.Grey,
},
[103] = {
foreground = Screen.colors.Yellow,
italic = true,
bold = true, bold = true,
underline = true, underline = true,
italic = true, background = Screen.colors.Pink,
strikethrough = true,
}, },
}) }
exec([[ exec([[
set wildoptions=pum,fuzzy set wildoptions=pum,fuzzy
hi Pmenu guifg=White guibg=Grey gui=underline,italic hi Pmenu guifg=White guibg=Grey gui=underline,italic
@ -3683,8 +3672,8 @@ describe('builtin popupmenu', function()
screen:expect([[ screen:expect([[
| |
{1:~ }|*16 {1:~ }|*16
{1:~ }{3: }{5:pl}{3:a}{5:c}{3:e }{1: }| {1:~ }{102: }{101:pl}{102:a}{101:c}{102:e }{1: }|
{1:~ }{2: un}{4:pl}{2:a}{4:c}{2:e }{1: }| {1:~ }{100: un}{103:pl}{100:a}{103:c}{100:e }{1: }|
:sign place^ | :sign place^ |
]]) ]])
end end

View File

@ -193,13 +193,6 @@ describe('eval-API', function()
it('are highlighted by vim.vim syntax file', function() it('are highlighted by vim.vim syntax file', function()
local screen = Screen.new(40, 8) local screen = Screen.new(40, 8)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Brown },
[2] = { foreground = Screen.colors.DarkCyan },
[3] = { foreground = Screen.colors.SlateBlue },
[4] = { foreground = Screen.colors.Fuchsia },
[5] = { bold = true, foreground = Screen.colors.Blue },
})
command('set ft=vim') command('set ft=vim')
command('set rtp^=build/runtime/') command('set rtp^=build/runtime/')
@ -210,10 +203,10 @@ describe('eval-API', function()
call not_a_function(42)]]) call not_a_function(42)]])
screen:expect([[ screen:expect([[
{1:call} {2:bufnr}{3:(}{4:'%'}{3:)} | {15:call} {25:bufnr}{16:(}{26:'%'}{16:)} |
{1:call} {2:nvim_input}{3:(}{4:'typing...'}{3:)} | {15:call} {25:nvim_input}{16:(}{26:'typing...'}{16:)} |
{1:call} not_a_function{3:(}{4:42}{3:^)} | {15:call} not_a_function{16:(}{26:42}{16:^)} |
{5:~ }|*4 {1:~ }|*4
| |
]]) ]])
end) end)

View File

@ -189,11 +189,6 @@ describe('uncaught exception', function()
it('multiline exception remains multiline #25350', function() it('multiline exception remains multiline #25350', function()
local screen = Screen.new(80, 11) local screen = Screen.new(80, 11)
screen:set_default_attr_ids({
[1] = { bold = true, reverse = true }, -- MsgSeparator
[2] = { foreground = Screen.colors.White, background = Screen.colors.Red }, -- ErrorMsg
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach() screen:attach()
exec_lua([[ exec_lua([[
function _G.Oops() function _G.Oops()
@ -203,17 +198,17 @@ describe('uncaught exception', function()
feed(':try\rlua _G.Oops()\rendtry\r') feed(':try\rlua _G.Oops()\rendtry\r')
screen:expect { screen:expect {
grid = [[ grid = [[
{1: }| {3: }|
:try | :try |
: lua _G.Oops() | : lua _G.Oops() |
: endtry | : endtry |
{2:Error detected while processing :} | {9:Error detected while processing :} |
{2:E5108: Error executing lua [string "<nvim>"]:2: oops} | {9:E5108: Error executing lua [string "<nvim>"]:2: oops} |
{2:stack traceback:} | {9:stack traceback:} |
{2: [C]: in function 'error'} | {9: [C]: in function 'error'} |
{2: [string "<nvim>"]:2: in function 'Oops'} | {9: [string "<nvim>"]:2: in function 'Oops'} |
{2: [string ":lua"]:1: in main chunk} | {9: [string ":lua"]:1: in main chunk} |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]], ]],
} }
end) end)

View File

@ -109,9 +109,6 @@ describe('timers', function()
it('can invoke redraw in blocking getchar() call', function() it('can invoke redraw in blocking getchar() call', function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
})
api.nvim_buf_set_lines(0, 0, -1, true, { 'ITEM 1', 'ITEM 2' }) api.nvim_buf_set_lines(0, 0, -1, true, { 'ITEM 1', 'ITEM 2' })
source([[ source([[
@ -229,7 +226,6 @@ describe('timers', function()
it("doesn't mess up the cmdline", function() it("doesn't mess up the cmdline", function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach() screen:attach()
screen:set_default_attr_ids({ [0] = { bold = true, foreground = 255 } })
source([[ source([[
let g:val = 0 let g:val = 0
func! MyHandler(timer) func! MyHandler(timer)
@ -247,7 +243,7 @@ describe('timers', function()
feed(':good') feed(':good')
screen:expect([[ screen:expect([[
| |
{0:~ }|*4 {1:~ }|*4
:good^ | :good^ |
]]) ]])
command('let g:val = 1') command('let g:val = 1')