refactor(tests): use new global defaults instead of set_default_attr_ids

This will be done in batches.
This commit is contained in:
bfredl 2024-03-26 21:23:36 +01:00
parent 0c0be09eab
commit 35f2bb05a5
9 changed files with 713 additions and 812 deletions

View File

@ -1265,15 +1265,6 @@ describe('cmdheight=0', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(25, 5) screen = Screen.new(25, 5)
screen:set_default_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { bold = true, reverse = true },
[3] = { bold = true },
[4] = { foreground = Screen.colors.White, background = Screen.colors.Red },
[5] = { foreground = Screen.colors.SeaGreen4, bold = true },
[6] = { reverse = true },
[7] = { background = Screen.colors.Yellow },
}
screen:attach() screen:attach()
end) end)
@ -1302,7 +1293,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }|*2 {1:~ }|*2
{2:[No Name] }| {3:[No Name] }|
| |
]], ]],
} }
@ -1314,7 +1305,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{2:[No Name] }| {3:[No Name] }|
]], ]],
} }
end) end)
@ -1364,7 +1355,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{3:-- INSERT --} | {5:-- INSERT --} |
]], ]],
} }
feed('<Esc>') feed('<Esc>')
@ -1400,7 +1391,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
| |
{1:~ }| {1:~ }|
{2: }| {3: }|
:call input("foo >") | :call input("foo >") |
foo >^ | foo >^ |
]], ]],
@ -1422,26 +1413,26 @@ describe('cmdheight=0', function()
feed(':split<CR>') feed(':split<CR>')
screen:expect { screen:expect {
grid = [[ grid = [[
{2: }| {3: }|
:split | :split |
{4:E36: Not enough room} | {9:E36: Not enough room} |
{5:Press ENTER or type comma}| {6:Press ENTER or type comma}|
{5:nd to continue}^ | {6:nd to continue}^ |
]], ]],
} }
feed('<CR>') feed('<CR>')
screen:expect { screen:expect {
grid = [[ grid = [[
{3:foo }| {5:foo }|
^ | ^ |
{1:~ }|*2 {1:~ }|*2
{2:[No Name] }| {3:[No Name] }|
]], ]],
} }
feed(':') feed(':')
screen:expect { screen:expect {
grid = [[ grid = [[
{3:foo }| {5:foo }|
| |
{1:~ }|*2 {1:~ }|*2
:^ | :^ |
@ -1450,10 +1441,10 @@ describe('cmdheight=0', function()
feed('<Esc>') feed('<Esc>')
screen:expect { screen:expect {
grid = [[ grid = [[
{3:foo }| {5:foo }|
^ | ^ |
{1:~ }|*2 {1:~ }|*2
{2:[No Name] }| {3:[No Name] }|
]], ]],
showmode = {}, showmode = {},
} }
@ -1488,16 +1479,16 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
fo^o | fo^o |
{1:~ }|*3 {1:~ }|*3
{2:[No Name] [+] }| {3:[No Name] [+] }|
]], ]],
} }
feed(':%s/foo/bar/gc<CR>') feed(':%s/foo/bar/gc<CR>')
screen:expect { screen:expect {
grid = [[ grid = [[
{6:foo} | {2:foo} |
{1:~ }|*3 {1:~ }|*3
{5:replace wi...q/l/^E/^Y)?}^ | {6:replace wi...q/l/^E/^Y)?}^ |
]], ]],
} }
@ -1506,7 +1497,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^bar | ^bar |
{1:~ }|*3 {1:~ }|*3
{2:[No Name] [+] }| {3:[No Name] [+] }|
]], ]],
} }
@ -1525,7 +1516,7 @@ describe('cmdheight=0', function()
feed('iaabbaa<esc>/aa<cr>') feed('iaabbaa<esc>/aa<cr>')
screen:expect { screen:expect {
grid = [[ grid = [[
{7:^aa}bb{7:aa} | {10:^aa}bb{10:aa} |
{1:~ }|*4 {1:~ }|*4
]], ]],
} }
@ -1584,7 +1575,7 @@ describe('cmdheight=0', function()
[2:-------------------------]|*4 [2:-------------------------]|*4
[3:-------------------------]| [3:-------------------------]|
## grid 2 ## grid 2
{6:p} | {2:p} |
{1:~ }|*4 {1:~ }|*4
## grid 3 ## grid 3
/p^ | /p^ |
@ -1610,7 +1601,7 @@ describe('cmdheight=0', function()
]]) ]])
feed(':') feed(':')
screen:expect([[ screen:expect([[
{3:c :}| {5:c :}|
| |
{1:~ }|*2 {1:~ }|*2
:^ | :^ |
@ -1618,14 +1609,14 @@ describe('cmdheight=0', function()
feed('echo') feed('echo')
-- not redrawn yet -- not redrawn yet
screen:expect([[ screen:expect([[
{3:c :}| {5:c :}|
| |
{1:~ }|*2 {1:~ }|*2
:echo^ | :echo^ |
]]) ]])
command('redrawstatus') command('redrawstatus')
screen:expect([[ screen:expect([[
{3:c :echo}| {5:c :echo}|
| |
{1:~ }|*2 {1:~ }|*2
:echo^ | :echo^ |
@ -1646,7 +1637,7 @@ describe('cmdheight=0', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }{1:~ }|*3 {1:~ }{1:~ }|*3
{2:[No Name] }{1:~ }| {3:[No Name] }{1:~ }|
{1:~ }| {1:~ }|
{1:~ }{1:~ }|*3 {1:~ }{1:~ }|*3
]]) ]])
@ -1654,7 +1645,7 @@ describe('cmdheight=0', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }{1:~ }| {1:~ }{1:~ }|
{2:[No Name] }{1:~ }| {3:[No Name] }{1:~ }|
{1:~ }| {1:~ }|
{1:~ }{1:~ }|*5 {1:~ }{1:~ }|*5
]]) ]])
@ -1664,7 +1655,7 @@ describe('cmdheight=0', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }{1:~ }|*3 {1:~ }{1:~ }|*3
{2:[No Name] }{1:~ }| {3:[No Name] }{1:~ }|
{1:~ }| {1:~ }|
{1:~ }{1:~ }|*3 {1:~ }{1:~ }|*3
]]) ]])
@ -1686,7 +1677,7 @@ describe('cmdheight=0', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }|*2 {1:~ }|*2
{2:[No Name] }| {3:[No Name] }|
| |
]]) ]])
command('set cmdheight=0') command('set cmdheight=0')
@ -1694,7 +1685,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{2:[No Name] }| {3:[No Name] }|
]], ]],
} }
command('resize -1') command('resize -1')
@ -1702,7 +1693,7 @@ describe('cmdheight=0', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }|*2 {1:~ }|*2
{2:[No Name] }| {3:[No Name] }|
| |
]], ]],
} }
@ -1710,7 +1701,7 @@ describe('cmdheight=0', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{2:[No Name] }| {3:[No Name] }|
]]) ]])
end) end)

View File

@ -280,21 +280,16 @@ end)
it('typing a simplifiable key at hit-enter prompt triggers mapping vim-patch:8.2.0839', function() it('typing a simplifiable key at hit-enter prompt triggers mapping vim-patch:8.2.0839', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { bold = true, reverse = true }, -- MsgSeparator
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach() screen:attach()
command([[nnoremap <C-6> <Cmd>echo 'hit ctrl-6'<CR>]]) command([[nnoremap <C-6> <Cmd>echo 'hit ctrl-6'<CR>]])
feed_command('ls') feed_command('ls')
screen:expect([[ screen:expect([[
| |
{1:~ }|*3 {1:~ }|*3
{2: }| {3: }|
:ls | :ls |
1 %a "[No Name]" line 1 | 1 %a "[No Name]" line 1 |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('<C-6>') feed('<C-6>')
screen:expect([[ screen:expect([[
@ -331,12 +326,6 @@ describe('input non-printable chars', function()
it("doesn't crash when echoing them back", function() it("doesn't crash when echoing them back", function()
write_file('Xtest-overwrite', [[foobar]]) write_file('Xtest-overwrite', [[foobar]])
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
[3] = { bold = true, foreground = Screen.colors.SeaGreen4 },
[4] = { bold = true, reverse = true },
}
screen:attach() screen:attach()
command('set shortmess-=F') command('set shortmess-=F')
@ -354,45 +343,45 @@ describe('input non-printable chars', function()
screen:expect([[ screen:expect([[
foobar | foobar |
{1:~ }|*3 {1:~ }|*3
{4: }| {3: }|
"Xtest-overwrite" | "Xtest-overwrite" |
{2:WARNING: The file has been changed since reading it!!!} | {9:WARNING: The file has been changed since reading it!!!} |
{3:Do you really want to write to it (y/n)?}^ | {6:Do you really want to write to it (y/n)?}^ |
]]) ]])
feed('u') feed('u')
screen:expect([[ screen:expect([[
foobar | foobar |
{1:~ }|*2 {1:~ }|*2
{4: }| {3: }|
"Xtest-overwrite" | "Xtest-overwrite" |
{2:WARNING: The file has been changed since reading it!!!} | {9:WARNING: The file has been changed since reading it!!!} |
{3:Do you really want to write to it (y/n)?}u | {6:Do you really want to write to it (y/n)?}u |
{3:Do you really want to write to it (y/n)?}^ | {6:Do you really want to write to it (y/n)?}^ |
]]) ]])
feed('\005') feed('\005')
screen:expect([[ screen:expect([[
foobar | foobar |
{1:~ }| {1:~ }|
{4: }| {3: }|
"Xtest-overwrite" | "Xtest-overwrite" |
{2:WARNING: The file has been changed since reading it!!!} | {9:WARNING: The file has been changed since reading it!!!} |
{3:Do you really want to write to it (y/n)?}u | {6:Do you really want to write to it (y/n)?}u |
{3:Do you really want to write to it (y/n)?} | {6:Do you really want to write to it (y/n)?} |
{3:Do you really want to write to it (y/n)?}^ | {6:Do you really want to write to it (y/n)?}^ |
]]) ]])
feed('n') feed('n')
screen:expect([[ screen:expect([[
foobar | foobar |
{4: }| {3: }|
"Xtest-overwrite" | "Xtest-overwrite" |
{2:WARNING: The file has been changed since reading it!!!} | {9:WARNING: The file has been changed since reading it!!!} |
{3:Do you really want to write to it (y/n)?}u | {6:Do you really want to write to it (y/n)?}u |
{3:Do you really want to write to it (y/n)?} | {6:Do you really want to write to it (y/n)?} |
{3:Do you really want to write to it (y/n)?}n | {6:Do you really want to write to it (y/n)?}n |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('<cr>') feed('<cr>')
@ -437,10 +426,6 @@ describe('display is updated', function()
local screen local screen
before_each(function() before_each(function()
screen = Screen.new(60, 8) screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
[2] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
end) end)
@ -452,7 +437,7 @@ describe('display is updated', function()
abc | abc |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
@ -464,7 +449,7 @@ describe('display is updated', function()
abc | abc |
^ | ^ |
{1:~ }|*5 {1:~ }|*5
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
end) end)

File diff suppressed because it is too large Load Diff

View File

@ -12,20 +12,13 @@ describe('ui mode_change event', function()
clear() clear()
screen = Screen.new(25, 4) screen = Screen.new(25, 4)
screen:attach({ rgb = true }) screen:attach({ rgb = true })
screen:set_default_attr_ids({
[0] = { bold = true, foreground = 255 },
[1] = { bold = true, reverse = true },
[2] = { bold = true },
[3] = { reverse = true },
[4] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
end) end)
it('works in normal mode', function() it('works in normal mode', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -35,7 +28,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'operator', mode = 'operator',
@ -45,7 +38,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -61,7 +54,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'operator', mode = 'operator',
@ -71,8 +64,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
{4:E21: Cannot make changes, 'modifiable' is off} | {9:E21: Cannot make changes, 'modifiable' is off} |
]], ]],
mode = 'normal', mode = 'normal',
} }
@ -84,7 +77,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'replace', mode = 'replace',
@ -94,7 +87,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -106,8 +99,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
mode = 'insert', mode = 'insert',
} }
@ -116,7 +109,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
wor^d | wor^d |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -133,8 +126,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
word(stuff^ | word(stuff^ |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
mode = 'insert', mode = 'insert',
timeout = screen_timeout, timeout = screen_timeout,
@ -144,8 +137,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
word^(stuff) | word^(stuff) |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
mode = 'showmatch', mode = 'showmatch',
timeout = screen_timeout, timeout = screen_timeout,
@ -154,8 +147,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
word(stuff)^ | word(stuff)^ |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]], ]],
mode = 'insert', mode = 'insert',
timeout = screen_timeout, timeout = screen_timeout,
@ -168,8 +161,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
{2:-- REPLACE --} | {5:-- REPLACE --} |
]], ]],
mode = 'replace', mode = 'replace',
} }
@ -178,7 +171,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
wor^d | wor^d |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -190,7 +183,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
:^ | :^ |
]], ]],
mode = 'cmdline_normal', mode = 'cmdline_normal',
@ -200,7 +193,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
:^x | :^x |
]], ]],
mode = 'cmdline_insert', mode = 'cmdline_insert',
@ -210,7 +203,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
:^x | :^x |
]], ]],
mode = 'cmdline_replace', mode = 'cmdline_replace',
@ -220,7 +213,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
| |
{0:~ }|*2 {1:~ }|*2
:x^ | :x^ |
]], ]],
mode = 'cmdline_normal', mode = 'cmdline_normal',
@ -230,7 +223,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -243,8 +236,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
tex^t | tex^t |
{0:~ }|*2 {1:~ }|*2
{2:-- VISUAL --} | {5:-- VISUAL --} |
]], ]],
mode = 'visual', mode = 'visual',
} }
@ -253,7 +246,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
tex^t | tex^t |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',
@ -264,8 +257,8 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
tex^t | tex^t |
{0:~ }|*2 {1:~ }|*2
{2:-- VISUAL --} | {5:-- VISUAL --} |
]], ]],
mode = 'visual_select', mode = 'visual_select',
} }
@ -274,7 +267,7 @@ describe('ui mode_change event', function()
screen:expect { screen:expect {
grid = [[ grid = [[
tex^t | tex^t |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
mode = 'normal', mode = 'normal',

View File

@ -16,15 +16,6 @@ describe('multibyte rendering', function()
clear() clear()
screen = Screen.new(60, 6) screen = Screen.new(60, 6)
screen:attach({ rgb = true }) screen:attach({ rgb = true })
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { background = Screen.colors.WebGray },
[3] = { background = Screen.colors.LightMagenta },
[4] = { bold = true },
[5] = { foreground = Screen.colors.Blue },
[6] = { reverse = true, bold = true },
[7] = { reverse = true },
})
end) end)
it('works with composed char at start of line', function() it('works with composed char at start of line', function()
@ -83,17 +74,17 @@ describe('multibyte rendering', function()
ab ^ | ab ^ |
- | - |
{1:~ }|*3 {1:~ }|*3
{4:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
-- check double-width char is temporarily hidden when overlapped -- check double-width char is temporarily hidden when overlapped
fn.complete(4, { 'xx', 'yy' }) fn.complete(4, { 'xx', 'yy' })
screen:expect([[ screen:expect([[
ab xx^ | ab xx^ |
- {2: xx } | - {12: xx } |
{1:~ }{3: yy }{1: }| {1:~ }{4: yy }{1: }|
{1:~ }|*2 {1:~ }|*2
{4:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
-- check it is properly restored -- check it is properly restored
@ -102,7 +93,7 @@ describe('multibyte rendering', function()
ab xxz^ | ab xxz^ |
- | - |
{1:~ }|*3 {1:~ }|*3
{4:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
@ -129,7 +120,7 @@ describe('multibyte rendering', function()
{1:~ }a口口口口口口口口口口口口口口口口 | {1:~ }a口口口口口口口口口口口口口口口口 |
{1:~ }aa口口口口口口口口口口口口口口口口 | {1:~ }aa口口口口口口口口口口口口口口口口 |
{1:~ }aaa口口口口口口口口口口口口口口口口 | {1:~ }aaa口口口口口口口口口口口口口口口口 |
{6:[No Name] }{7:[No Name] [+] }| {3:[No Name] }{2:[No Name] [+] }|
| |
]]) ]])
end) end)
@ -139,7 +130,7 @@ describe('multibyte rendering', function()
feed('$') feed('$')
screen:expect { screen:expect {
grid = [[ grid = [[
{5:<ffff>}!!^! | {18:<ffff>}!!^! |
{1:~ }|*4 {1:~ }|*4
| |
]], ]],
@ -285,11 +276,6 @@ describe('multibyte rendering: statusline', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(40, 4) screen = Screen.new(40, 4)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { bold = true, reverse = true },
[3] = { background = Screen.colors.Red, foreground = Screen.colors.Gray100 },
})
screen:attach() screen:attach()
command('set laststatus=2') command('set laststatus=2')
end) end)
@ -299,7 +285,7 @@ describe('multibyte rendering: statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2: }| {3: }|
| |
]]) ]])
end) end)
@ -308,7 +294,7 @@ describe('multibyte rendering: statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2:abc }| {3:abc }|
| |
]]) ]])
end) end)
@ -317,7 +303,7 @@ describe('multibyte rendering: statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2:<9f> }| {3:<9f> }|
| |
]]) ]])
end) end)
@ -327,7 +313,7 @@ describe('multibyte rendering: statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2:o̸⃯ᷰ⃐⃧ }| {3:o̸⃯ᷰ⃐⃧ }|
| |
]]) ]])
end) end)
@ -337,7 +323,7 @@ describe('multibyte rendering: statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2:<9f><1df0><20ef><0338><20d0><20e7><20dd>}| {3:<9f><1df0><20ef><0338><20d0><20e7><20dd>}|
| |
]]) ]])
end) end)
@ -348,7 +334,7 @@ describe('multibyte rendering: statusline', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }| {1:~ }|
{2: Q }| {3: Q }|
| |
]], ]],
} }
@ -361,7 +347,7 @@ describe('multibyte rendering: statusline', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }| {1:~ }|
{2:🧑<EFBFBD>💻 }| {3:🧑<EFBFBD>💻 }|
| |
]], ]],
} }
@ -375,7 +361,7 @@ describe('multibyte rendering: statusline', function()
grid = [[ grid = [[
^ | ^ |
{1:~ }| {1:~ }|
{2:xx}{3:🧑<200d>💻}{2:yy }| {3:xx}{9:🧑<200d>💻}{3:yy }|
| |
]], ]],
} }

View File

@ -27,17 +27,13 @@ describe('screen', function()
set_session(screen_nvim) set_session(screen_nvim)
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = 255 },
[1] = { bold = true, reverse = true },
})
end) end)
it('default initial screen', function() it('default initial screen', function()
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*11 {1:~ }|*11
{1:[No Name] }| {3:[No Name] }|
| |
]]) ]])
end) end)
@ -811,9 +807,6 @@ end)
it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", function() it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", function()
clear() clear()
local screen = Screen.new(30, 2) local screen = Screen.new(30, 2)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
})
screen:attach() screen:attach()
command('set showcmd redrawdebug=compositor') command('set showcmd redrawdebug=compositor')
feed('d') feed('d')

View File

@ -140,58 +140,54 @@ describe('statuscolumn', function()
.. [[%=%{&rnu&&(v:lnum%2)?'\ '.v:relnum:''}]] .. [[%=%{&rnu&&(v:lnum%2)?'\ '.v:relnum:''}]]
.. [[%#LineNr#%{&rnu&&!(v:lnum%2)?'\ '.v:relnum:''}│]] .. [[%#LineNr#%{&rnu&&!(v:lnum%2)?'\ '.v:relnum:''}│]]
) )
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { foreground = Screen.colors.Brown },
})
screen:expect([[ screen:expect([[
{0:4 }{1:}aaaaa | {1:4 }{8:}aaaaa |
{0:5 }{1:}aaaaa | {1:5 }{8:}aaaaa |
{0:6 }{1:}aaaaa | {1:6 }{8:}aaaaa |
{0:7 }{1:}aaaaa | {1:7 }{8:}aaaaa |
{0:8 }{1:}^aaaaa | {1:8 }{8:}^aaaaa |
{0:9 }{1:}aaaaa | {1:9 }{8:}aaaaa |
{0:10}{1:}aaaaa | {1:10}{8:}aaaaa |
{0:11}{1:}aaaaa | {1:11}{8:}aaaaa |
{0:12}{1:}aaaaa | {1:12}{8:}aaaaa |
{0:13}{1:}aaaaa | {1:13}{8:}aaaaa |
{0:14}{1:}aaaaa | {1:14}{8:}aaaaa |
{0:15}{1:}aaaaa | {1:15}{8:}aaaaa |
{0:16}{1:}aaaaa | {1:16}{8:}aaaaa |
| |
]]) ]])
command('set relativenumber') command('set relativenumber')
screen:expect([[ screen:expect([[
{0:4 }{1: 4}aaaaa | {1:4 }{8: 4}aaaaa |
{0:5 3}{1:}aaaaa | {1:5 3}{8:}aaaaa |
{0:6 }{1: 2}aaaaa | {1:6 }{8: 2}aaaaa |
{0:7 1}{1:}aaaaa | {1:7 1}{8:}aaaaa |
{0:8 }{1: 0}^aaaaa | {1:8 }{8: 0}^aaaaa |
{0:9 1}{1:}aaaaa | {1:9 1}{8:}aaaaa |
{0:10}{1: 2}aaaaa | {1:10}{8: 2}aaaaa |
{0:11 3}{1:}aaaaa | {1:11 3}{8:}aaaaa |
{0:12}{1: 4}aaaaa | {1:12}{8: 4}aaaaa |
{0:13 5}{1:}aaaaa | {1:13 5}{8:}aaaaa |
{0:14}{1: 6}aaaaa | {1:14}{8: 6}aaaaa |
{0:15 7}{1:}aaaaa | {1:15 7}{8:}aaaaa |
{0:16}{1: 8}aaaaa | {1:16}{8: 8}aaaaa |
| |
]]) ]])
command('set nonumber') command('set nonumber')
screen:expect([[ screen:expect([[
{1:4}aaaaa | {8:4}aaaaa |
{0:3}{1:}aaaaa | {1:3}{8:}aaaaa |
{1:2}aaaaa | {8:2}aaaaa |
{0:1}{1:}aaaaa | {1:1}{8:}aaaaa |
{1:0}^aaaaa | {8:0}^aaaaa |
{0:1}{1:}aaaaa | {1:1}{8:}aaaaa |
{1:2}aaaaa | {8:2}aaaaa |
{0:3}{1:}aaaaa | {1:3}{8:}aaaaa |
{1:4}aaaaa | {8:4}aaaaa |
{0:5}{1:}aaaaa | {1:5}{8:}aaaaa |
{1:6}aaaaa | {8:6}aaaaa |
{0:7}{1:}aaaaa | {1:7}{8:}aaaaa |
{1:8}aaaaa | {8:8}aaaaa |
| |
]]) ]])
end) end)
@ -532,15 +528,11 @@ describe('statuscolumn', function()
it('does not corrupt the screen with minwid sign item', function() it('does not corrupt the screen with minwid sign item', function()
screen:try_resize(screen._width, 3) screen:try_resize(screen._width, 3)
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.Brown },
[1] = { foreground = Screen.colors.Blue4, background = Screen.colors.Gray },
})
command([[set stc=%6s\ %l]]) command([[set stc=%6s\ %l]])
exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 7, 0, {sign_text = "𒀀"})') exec_lua('vim.api.nvim_buf_set_extmark(0, ns, 7, 0, {sign_text = "𒀀"})')
screen:expect([[ screen:expect([[
{0: 𒀀 8 }^aaaaa | {8: 𒀀 8 }^aaaaa |
{0: }{1: }{0: 9 }aaaaa | {8: }{7: }{8: 9 }aaaaa |
| |
]]) ]])
end) end)

View File

@ -99,10 +99,6 @@ describe('tabline', function()
clear() clear()
screen = Screen.new(42, 5) screen = Screen.new(42, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true }, -- TabLineFill
})
end) end)
it('redraws when tabline option is set', function() it('redraws when tabline option is set', function()
@ -110,18 +106,18 @@ describe('tabline', function()
command('set showtabline=2') command('set showtabline=2')
screen:expect { screen:expect {
grid = [[ grid = [[
{1:asdf }| {2:asdf }|
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
command('set tabline=jkl') command('set tabline=jkl')
screen:expect { screen:expect {
grid = [[ grid = [[
{1:jkl }| {2:jkl }|
^ | ^ |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
@ -141,9 +137,9 @@ describe('tabline', function()
api.nvim_set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {}) api.nvim_set_option_value('tabline', '%1T口口%2Ta' .. ('b'):rep(38) .. '%999Xc', {})
screen:expect { screen:expect {
grid = [[ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| {2:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^1 | tab^1 |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
@ -151,27 +147,27 @@ describe('tabline', function()
api.nvim_input_mouse('left', 'press', '', 0, 0, 1) api.nvim_input_mouse('left', 'press', '', 0, 0, 1)
screen:expect { screen:expect {
grid = [[ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| {2:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^2 | tab^2 |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
api.nvim_input_mouse('left', 'press', '', 0, 0, 0) api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
screen:expect { screen:expect {
grid = [[ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| {2:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^1 | tab^1 |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
api.nvim_input_mouse('left', 'press', '', 0, 0, 39) api.nvim_input_mouse('left', 'press', '', 0, 0, 39)
screen:expect { screen:expect {
grid = [[ grid = [[
{1:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }| {2:<abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc }|
tab^2 | tab^2 |
{0:~ }|*2 {1:~ }|*2
| |
]], ]],
} }
@ -179,7 +175,7 @@ describe('tabline', function()
screen:expect { screen:expect {
grid = [[ grid = [[
tab^1 | tab^1 |
{0:~ }|*3 {1:~ }|*3
| |
]], ]],
} }

View File

@ -525,30 +525,24 @@ describe('local winbar with tabs', function()
clear() clear()
screen = Screen.new(60, 10) screen = Screen.new(60, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true },
[2] = { reverse = true },
[3] = { bold = true, foreground = Screen.colors.Blue },
[4] = { underline = true, background = Screen.colors.LightGray },
})
api.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 }) api.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 })
end) end)
it('works', function() it('works', function()
command('tabnew') command('tabnew')
screen:expect([[ screen:expect([[
{4: [No Name] }{1: [No Name] }{2: }{4:X}| {24: [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{3:~ }|*7 {1:~ }|*7
| |
]]) ]])
command('tabnext') command('tabnext')
screen:expect { screen:expect {
grid = [[ grid = [[
{1: [No Name] }{4: [No Name] }{2: }{4:X}| {5: [No Name] }{24: [No Name] }{2: }{24:X}|
{1:foo }| {5:foo }|
^ | ^ |
{3:~ }|*6 {1:~ }|*6
| |
]], ]],
} }
@ -561,11 +555,11 @@ describe('local winbar with tabs', function()
text]] text]]
screen:expect { screen:expect {
grid = [[ grid = [[
{1:foo }| {5:foo }|
some | some |
goofy | goofy |
tex^t | tex^t |
{3:~ }|*5 {1:~ }|*5
| |
]], ]],
} }
@ -574,9 +568,9 @@ describe('local winbar with tabs', function()
command 'tabedit' command 'tabedit'
screen:expect { screen:expect {
grid = [[ grid = [[
{4: + [No Name] }{1: [No Name] }{2: }{4:X}| {24: + [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{3:~ }|*7 {1:~ }|*7
| |
]], ]],
} }
@ -584,12 +578,12 @@ describe('local winbar with tabs', function()
command 'tabprev' command 'tabprev'
screen:expect { screen:expect {
grid = [[ grid = [[
{1: + [No Name] }{4: [No Name] }{2: }{4:X}| {5: + [No Name] }{24: [No Name] }{2: }{24:X}|
{1:foo }| {5:foo }|
some | some |
goofy | goofy |
tex^t | tex^t |
{3:~ }|*4 {1:~ }|*4
| |
]], ]],
} }
@ -609,16 +603,11 @@ it('winbar works properly when redrawing is postponed #23534', function()
}) })
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.Blue, bold = true },
[1] = { bold = true },
[2] = { bold = true, reverse = true },
})
screen:expect([[ screen:expect([[
{1:(winbar) }| {5:(winbar) }|
^ | ^ |
{0:~ }|*2 {1:~ }|*2
{2:(statusline) }| {3:(statusline) }|
| |
]]) ]])
end) end)