refactor(tests): all screen tests should use highlights

This is the first installment of a multi-PR series significantly
refactoring how highlights are being specified.

The end goal is to have a base set of 20 ish most common highlights,
and then specific files only need to add more groups to that as needed.

As a complicating factor, we also want to migrate to the new default
color scheme eventually. But by sharing a base set, that future PR
will hopefully be a lot smaller since a lot of tests will be migrated
just simply by updating the base set in place.

As a first step, fix the anti-pattern than Screen defaults to ignoring
highlights. Highlights are integral part of the screen state, not
something "extra" which we only test "sometimes". For now, we still
allow opt-out via the intentionally ugly

  screen._default_attr_ids = nil

The end goal is to get rid of all of these eventually (which will be
easier as part of the color scheme migration)
This commit is contained in:
bfredl
2024-03-22 11:02:52 +01:00
parent dc110cba3c
commit 0c59771e31
40 changed files with 793 additions and 711 deletions

View File

@ -1744,12 +1744,11 @@ describe('api/buf', function()
api.nvim_buf_set_text(0, 0, 0, 1, 3, { 'XXX', 'YYY' })
screen:expect([[
XXX |
YYY |
^ |
~ |
|
XXX |
YYY |
^ |
{1:~ }|
|
]])
end)

View File

@ -460,7 +460,7 @@ describe('API/extmarks', function()
-- This shouldn't seg fault
screen:expect([[
12345^ 1 |
~ |*8
{1:~ }|*8
|
]])
end)
@ -513,7 +513,7 @@ describe('API/extmarks', function()
insert('abc')
screen:expect([[
ab^c12345 |
~ |*8
{1:~ }|*8
|
]])
local rv = get_extmark_by_id(ns, marks[1])
@ -1734,16 +1734,17 @@ describe('API/extmarks', function()
command('d2')
screen:expect([[
S2^aaa bbb ccc |
aaa bbb ccc |*3
|*2
{7: }aaa bbb ccc |*3
{7: } |
|
]])
-- mark is restored with undo_restore == true
command('silent undo')
screen:expect([[
S1 ^aaa bbb ccc |
S1{7: }^aaa bbb ccc |
S1S2aaa bbb ccc |
S2 aaa bbb ccc |
aaa bbb ccc |*2
S2{7: }aaa bbb ccc |
{7: }aaa bbb ccc |*2
|
]])
-- decor is not removed twice
@ -1964,7 +1965,7 @@ describe('API/win_extmark', function()
grid = [[
non ui-watched line |
ui-watched lin^e |
~ |
{1:~ }|
|
]],
extmarks = {
@ -2052,7 +2053,7 @@ describe('API/win_extmark', function()
grid = [[
ui-watched linupdat^e|
e |
~ |
{1:~ }|
|
]],
extmarks = {
@ -2079,9 +2080,9 @@ describe('API/win_extmark', function()
grid = [[
## grid 1
[4:--------------------]|*3
[No Name] [+] |
{3:[No Name] [+] }|
[2:--------------------]|*2
[No Name] [+] |
{2:[No Name] [+] }|
[3:--------------------]|
## grid 2
non ui-watched line |
@ -2091,7 +2092,7 @@ describe('API/win_extmark', function()
## grid 4
non ui-watched line |
ui-watched lin^e |
~ |
{1:~ }|
]],
extmarks = {
[2] = {
@ -2112,13 +2113,13 @@ describe('API/win_extmark', function()
grid = [[
## grid 1
[4:--------------------]|*3
[No Name] [+] |
{3:[No Name] [+] }|
[2:--------------------]|*2
[No Name] [+] |
{2:[No Name] [+] }|
[3:--------------------]|
## grid 2
non ui-watched line |
ui-watched linupd@@@|
ui-watched linupd{1:@@@}|
## grid 3
|
## grid 4

View File

@ -1269,7 +1269,7 @@ describe('API', function()
api.nvim_paste('', true, 3)
screen:expect([[
|
~ |*2
{1:~ }|*2
:Foo^ |
]])
end)
@ -1280,8 +1280,8 @@ describe('API', function()
api.nvim_paste('normal! \023\022\006\027', true, -1)
screen:expect([[
|
~ |*2
:normal! ^W^V^F^[^ |
{1:~ }|*2
:normal! {18:^W^V^F^[}^ |
]])
end)
it('crlf=false does not break lines at CR, CRLF', function()
@ -1981,9 +1981,9 @@ describe('API', function()
-- Make any RPC request (can be non-async: op-pending does not block).
api.nvim_get_current_buf()
screen:expect([[
^a$ |
b$ |
c$ |
^a{1:$} |
b{1:$} |
c{1:$} |
|
]])
end)

View File

@ -1233,7 +1233,7 @@ describe('pty process teardown', function()
screen:attach()
screen:expect([[
^ |
~ |*4
{1:~ }|*4
|
]])
end)

View File

@ -120,9 +120,9 @@ describe('command-line option', function()
feed('i:cq<CR>')
screen:expect([[
|
[Process exited 1] |
[Process exited 1]{2: } |
|*5
-- TERMINAL -- |
{5:-- TERMINAL --} |
]])
--[=[ Example of incorrect output:
screen:expect([[

View File

@ -83,6 +83,8 @@ describe('startup', function()
local screen
screen = Screen.new(60, 7)
screen:attach()
-- not the same colors on windows for some reason
screen._default_attr_ids = nil
local id = fn.termopen({
nvim_prog,
'-u',
@ -326,6 +328,9 @@ describe('startup', function()
local screen = Screen.new(25, 3)
-- Remote UI connected by --embed.
screen:attach()
-- TODO: a lot of tests in this file already use the new default color scheme.
-- once we do the batch update of tests to use it, remove this workarond
screen._default_attr_ids = nil
command([[echo has('ttyin') has('ttyout')]])
screen:expect([[
^ |
@ -337,6 +342,7 @@ describe('startup', function()
it('in a TTY: has("ttyin")==1 has("ttyout")==1', function()
local screen = Screen.new(25, 4)
screen:attach()
screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@ -428,6 +434,7 @@ describe('startup', function()
it('input from pipe (implicit) #7679', function()
local screen = Screen.new(25, 4)
screen:attach()
screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@ -589,6 +596,7 @@ describe('startup', function()
local screen
screen = Screen.new(60, 6)
screen:attach()
screen._default_attr_ids = nil
local id = fn.termopen({
nvim_prog,
'-u',
@ -1123,6 +1131,7 @@ describe('user config init', function()
local screen = Screen.new(50, 8)
screen:attach()
screen._default_attr_ids = nil
fn.termopen({ nvim_prog }, {
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),

View File

@ -66,8 +66,8 @@ describe('CTRL-C (mapped)', function()
feed('i')
screen:expect([[
^ |
~ |*4
-- INSERT -- |
{1:~ }|*4
{5:-- INSERT --} |
]])
end)
@ -81,8 +81,8 @@ describe('CTRL-C (mapped)', function()
feed('i')
screen:expect([[
^ |
~ |*4
-- INSERT -- |
{1:~ }|*4
{5:-- INSERT --} |
]])
end)
end)

View File

@ -420,12 +420,12 @@ describe('named marks view', function()
feed("<C-w>p'a")
screen:expect([[
|
~ |*3
[No Name] |
{1:~ }|*3
{2:[No Name] }|
6 line |
^7 line |
8 line |
{MATCH:.*marks} |
{3:<itor-marks }|
|
]])
end)
@ -453,7 +453,7 @@ describe('named marks view', function()
command('bwipe!')
screen:expect([[
^ |
~ |*4
{1:~ }|*4
|
]])
command('rshada!')

View File

@ -109,19 +109,19 @@ describe('Screen', function()
command('map <expr> x input("> ")')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
|
]])
feed('x')
screen:expect([[
|
~ |*3
{1:~ }|*3
> ^ |
]])
feed('\n')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
> |
]])
end)
@ -131,20 +131,20 @@ describe('Screen', function()
feed('i')
screen:expect([[
^ |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('x')
screen:expect([[
|
~ |*3
{1:~ }|*3
> ^ |
]])
feed('\n')
screen:expect([[
^ |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
end)
@ -153,7 +153,7 @@ describe('Screen', function()
feed(':<F2>')
screen:expect([[
|
~ |*3
{1:~ }|*3
:^ |
]])
end)
@ -181,7 +181,7 @@ describe('Screen', function()
one |
^two |
three |
[on] |
{9:[on] }|
|
]])
end)
@ -191,15 +191,16 @@ describe('Screen', function()
command('nmap <expr> <F2> execute("throw 42")')
feed('<F2>')
screen:expect([[
|*2
Error detected while processing : |
E605: Exception not caught: 42 |
Press ENTER or type command to continue^ |
|
{3: }|
{9:Error detected while processing :} |
{9:E605: Exception not caught: 42} |
{6:Press ENTER or type command to continue}^ |
]])
feed('<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
|
]])
end)
@ -210,32 +211,32 @@ describe('Screen', function()
feed(':echo "foo')
screen:expect([[
|
~ |*3
{1:~ }|*3
:echo "foo^ |
]])
feed('<F2>')
screen:expect([[
|
{3: }|
:echo "foo |
Error detected while processing : |
E605: Exception not caught: 42 |
{9:Error detected while processing :} |
{9:E605: Exception not caught: 42} |
:echo "foo^ |
]])
feed('"')
screen:expect([[
|
{3: }|
:echo "foo |
Error detected while processing : |
E605: Exception not caught: 42 |
{9:Error detected while processing :} |
{9:E605: Exception not caught: 42} |
:echo "foo"^ |
]])
feed('\n')
screen:expect([[
:echo "foo |
Error detected while processing : |
E605: Exception not caught: 42 |
{9:Error detected while processing :} |
{9:E605: Exception not caught: 42} |
foo |
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
end)
@ -246,7 +247,7 @@ describe('Screen', function()
feed(': nmap a<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
n a b |
]])
end)

View File

@ -38,6 +38,7 @@ describe(':oldfiles', function()
it('shows most recently used files', function()
local screen = Screen.new(100, 5)
screen:attach()
screen._default_attr_ids = nil
feed_command('edit testfile1')
feed_command('edit testfile2')
feed_command('wshada')

View File

@ -170,6 +170,7 @@ describe('swapfile detection', function()
set_session(nvim2)
local screen2 = Screen.new(256, 40)
screen2:attach()
screen2._default_attr_ids = nil
exec(init)
command('autocmd! nvim_swapfile') -- Delete the default handler (which skips the dialog).

View File

@ -50,7 +50,7 @@ describe('107', function()
[1, '1 '] |
[50, '50 '] |
^[59, '59 '] |
~ |*9
{1:~ }|*9
3 more lines |
]])
end)

View File

@ -24,26 +24,26 @@ describe('argument list commands', function()
feed(':confirm quit\n')
screen:expect([[
|
~ |
|
{1:~ }|
{3: }|
:confirm quit |
2 more files to edit. Quit anyway? |
[Y]es, (N)o: ^ |
{6:2 more files to edit. Quit anyway?} |
{6:[Y]es, (N)o: }^ |
]])
feed('N')
screen:expect([[
^ |
~ |*4
{1:~ }|*4
|
]])
feed(':confirm quit\n')
screen:expect([[
|
~ |
|
{1:~ }|
{3: }|
:confirm quit |
2 more files to edit. Quit anyway? |
[Y]es, (N)o: ^ |
{6:2 more files to edit. Quit anyway?} |
{6:[Y]es, (N)o: }^ |
]])
expect_exit(1000, feed, 'Y')
end)

View File

@ -93,8 +93,8 @@ describe('cmdline', function()
feed_command('DoSomething')
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
Executing: DoSomething |
Executing: echo 'hello' |set ts=4 |let v = '123' |echo v |
hello |
@ -102,7 +102,7 @@ describe('cmdline', function()
Executing: let v = '123' |echo v |
Executing: echo v |
123 |
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
end)

View File

@ -15,13 +15,13 @@ describe('cpoptions', function()
feed('c2w')
screen:expect([[
^one tw$ three |
~ |*4
-- INSERT -- |
{1:~ }|*4
{5:-- INSERT --} |
]])
feed('vim<Esc>')
screen:expect([[
vi^m three |
~ |*4
{1:~ }|*4
|
]])
end)

View File

@ -149,7 +149,7 @@ describe('display', function()
]])
feed('736|')
screen:expect([[
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{1:<<<}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|*11
^aaaaaaaaaaaaaaa |
|
@ -157,22 +157,22 @@ describe('display', function()
-- The correct part of the last line is moved into view.
feed('D')
screen:expect([[
<<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{1:<<<}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|*10
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@|
bbbbb bbbbb bbbbb bbbbb bbbbb bb{1:@@@}|
|
]])
-- "w_skipcol" does not change because the topline is still long enough
-- to maintain the current skipcol.
feed('g04l11gkD')
screen:expect([[
<<<^a |
{1:<<<}^a |
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
bbbbb ccccc ccccc ccccc ccccc cccc|
c ccccc ccccc ddddd ddddd ddddd ddd|
dd ddddd ddddd ddddd |
~ |*8
{1:~ }|*8
|
]])
-- "w_skipcol" is reset to bring the entire topline into view because
@ -183,7 +183,7 @@ describe('display', function()
aa^a |
bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb|
bbbbb ccccc ccccc ccccc ccccc cccc|
c ccccc ccccc ddddd ddddd ddddd @@@|
c ccccc ccccc ddddd ddddd ddddd {1:@@@}|
|
]])
end)
@ -197,7 +197,7 @@ describe('display', function()
norm $j
]])
screen:expect([[
<<<bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{1:<<<}bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*5
b^b |
|
@ -207,7 +207,7 @@ describe('display', function()
exec('set number cpo+=n scrolloff=0')
feed('$0')
screen:expect([[
<<<b^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{1:<<<}b^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])
@ -215,14 +215,14 @@ describe('display', function()
exec('set smoothscroll')
feed('$b')
screen:expect([[
2 b ^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{8: 2 }b ^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])
-- Same for "ge".
feed('$ge')
screen:expect([[
2 ^b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{8: 2 }^b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*6
|
]])

View File

@ -22,15 +22,15 @@ describe(':highlight', function()
-- is discarded resulting in test failure
screen:expect([[
:highlight |
SpecialKey xxx ctermfg=4 |
guifg=Blue |
EndOfBuffer xxx links to NonText|
SpecialKey {18:xxx} {18:ctermfg=}4 |
{18:guifg=}Blue |
EndOfBuffer {1:xxx} {18:links to} NonText|
|
TermCursor xxx cterm=reverse |
gui=reverse |
TermCursor {2:xxx} {18:cterm=}reverse |
{18:gui=}reverse |
TermCursorNC xxx cleared |
NonText xxx ctermfg=12 |
-- More --^ |
NonText {1:xxx} {18:ctermfg=}12 |
{6:-- More --}^ |
]])
feed('q')
poke_eventloop() -- wait until we're back to normal

View File

@ -66,11 +66,11 @@ describe('set', function()
command('verbose set scroll?')
screen:expect([[
|
~ |*11
|
{1:~ }|*11
{3: }|
scroll=7 |
Last set from changed window size |
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
end)

View File

@ -58,11 +58,11 @@ describe('prompt buffer', function()
]])
screen:expect([[
cmd: ^ |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
end
@ -79,15 +79,15 @@ describe('prompt buffer', function()
Command: "hello" |
Result: "hello" |
cmd: ^ |
[Prompt] |
{3:[Prompt] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('exit\n')
screen:expect([[
^other buffer |
~ |*8
{1:~ }|*8
|
]])
end)
@ -98,43 +98,43 @@ describe('prompt buffer', function()
feed('hello<BS><BS>')
screen:expect([[
cmd: hel^ |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<Left><Left><Left><BS>-')
screen:expect([[
cmd: -^hel |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<C-O>lz')
screen:expect([[
cmd: -hz^el |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<End>x')
screen:expect([[
cmd: -hzelx^ |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<C-U>exit\n')
screen:expect([[
^other buffer |
~ |*8
{1:~ }|*8
|
]])
end)
@ -143,32 +143,30 @@ describe('prompt buffer', function()
it('switch windows', function()
source_script()
feed('<C-O>:call SwitchWindows()<CR>')
screen:expect {
grid = [[
screen:expect([[
cmd: |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{2:[Prompt] [+] }|
^other buffer |
~ |*3
{1:~ }|*3
|
]],
}
]])
feed('<C-O>:call SwitchWindows()<CR>')
screen:expect([[
cmd: ^ |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
-- INSERT -- |
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<Esc>')
screen:expect([[
cmd:^ |
~ |*3
[Prompt] [+] |
{1:~ }|*3
{3:[Prompt] [+] }|
other buffer |
~ |*3
{1:~ }|*3
|
]])
end)

View File

@ -66,8 +66,8 @@ describe('put', function()
three more text │ three more text |
^four more text │ four more text |
│ |
~ ~ |*2
[No Name] [+] [No Name] [+] |
{1:~ }│{1:~ }|*2
{3:[No Name] [+] }{2:[No Name] [+] }|
|
]])
end)

View File

@ -23,9 +23,9 @@ describe('smoothscroll', function()
set number
]])
feed('<C-Y>')
screen:expect({ any = ' 1 ^one' })
screen:expect({ any = '{8: 1 }^one' })
feed('<C-E><C-E><C-E>')
screen:expect({ any = ' 2 ^two' })
screen:expect({ any = '{8: 2 }^two' })
end)
-- oldtest: Test_smoothscroll_CtrlE_CtrlY()
@ -43,28 +43,28 @@ describe('smoothscroll', function()
long word long word long word |
^line |
line |*2
~ |*2
{1:~ }|*2
|
]]
local s2 = [[
<<<d word word word word word word word |
{1:<<<}d word word word word word word word |
word word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
line |*2
~ |*3
{1:~ }|*3
|
]]
local s3 = [[
<<<d word word word |
{1:<<<}d word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
line |*2
~ |*4
{1:~ }|*4
|
]]
local s4 = [[
@ -73,28 +73,28 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
~ |*5
{1:~ }|*5
|
]]
local s5 = [[
<<<d word word word |
{1:<<<}d word word word |
line three |
long word long word long word long word |
long word long word long word |
line |*2
^line |
~ |*4
{1:~ }|*4
|
]]
local s6 = [[
<<<d word word word word word word word |
{1:<<<}d word word word word word word word |
word word word word |
line three |
long word long word long word long word |
long word long word long word |
line |*2
^line |
~ |*3
{1:~ }|*3
|
]]
local s7 = [[
@ -105,7 +105,7 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
~ |*2
{1:~ }|*2
|
]]
local s8 = [[
@ -117,7 +117,7 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
~ |
{1:~ }|
|
]]
feed('<C-E>')
@ -160,7 +160,7 @@ describe('smoothscroll', function()
ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
ϛϛϛϛϛ |
222222222222222222222222222222222222 |
~ |*2
{1:~ }|*2
|
]])
end)
@ -181,134 +181,136 @@ describe('smoothscroll', function()
endfunc
]])
screen:expect([[
1 one word word word word word word wo|
{8: 1 }one word word word word word word wo|
rd word word word word word word word wo|
rd word word word word word |
2 two long word long word long word lo|
{8: 2 }two long word long word long word lo|
ng word long word long word long word |
3 ^line |
4 line |
5 line |
~ |*3
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*3
|
]])
feed('<C-E>')
screen:expect([[
<<<word word word word word word word wo|
{1:<<<}word word word word word word word wo|
rd word word word word word |
2 two long word long word long word lo|
{8: 2 }two long word long word long word lo|
ng word long word long word long word |
3 ^line |
4 line |
5 line |
~ |*4
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*4
|
]])
feed('<C-E>')
screen:expect([[
<<<word word word word word |
2 two long word long word long word lo|
{1:<<<}word word word word word |
{8: 2 }two long word long word long word lo|
ng word long word long word long word |
3 ^line |
4 line |
5 line |
~ |*5
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*5
|
]])
exec('set cpo-=n')
screen:expect([[
<<< d word word word word word word |
2 two long word long word long word lo|
ng word long word long word long wor|
d |
3 ^line |
4 line |
5 line |
~ |*4
{1:<<<}{8: }d word word word word word word |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long wor|
{8: }d |
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*4
|
]])
feed('<C-Y>')
screen:expect([[
<<< rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word lo|
ng word long word long word long wor|
d |
3 ^line |
4 line |
5 line |
~ |*3
{1:<<<}{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long wor|
{8: }d |
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*3
|
]])
feed('<C-Y>')
screen:expect([[
1 one word word word word word word wo|
rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word lo|
ng word long word long word long wor|
d |
3 ^line |
4 line |
5 line |
~ |*2
{8: 1 }one word word word word word word wo|
{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long wor|
{8: }d |
{8: 3 }^line |
{8: 4 }line |
{8: 5 }line |
{1:~ }|*2
|
]])
exec('botright split')
feed('gg')
screen:expect([[
1 one word word word word word word wo|
rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word@@@|
[No Name] [+] |
1 ^one word word word word word word wo|
rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word lo|
ng word long word long word long @@@|
[No Name] [+] |
{8: 1 }one word word word word word word wo|
{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word{1:@@@}|
{2:[No Name] [+] }|
{8: 1 }^one word word word word word word wo|
{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long {1:@@@}|
{3:[No Name] [+] }|
|
]])
feed('<C-E>')
screen:expect([[
1 one word word word word word word wo|
rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word@@@|
[No Name] [+] |
<<< rd word word word word word word wor|
d word word word word word word^ |
2 two long word long word long word lo|
ng word long word long word long wor|
d |
[No Name] [+] |
{8: 1 }one word word word word word word wo|
{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word{1:@@@}|
{2:[No Name] [+] }|
{1:<<<}{8: }rd word word word word word word wor|
{8: }d word word word word word word^ |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long wor|
{8: }d |
{3:[No Name] [+] }|
|
]])
feed('<C-E>')
screen:expect([[
1 one word word word word word word wo|
rd word word word word word word wor|
d word word word word word word |
2 two long word long word long word@@@|
[No Name] [+] |
<<< d word word word word word word^ |
2 two long word long word long word lo|
ng word long word long word long wor|
d |
3 line |
[No Name] [+] |
{8: 1 }one word word word word word word wo|
{8: }rd word word word word word word wor|
{8: }d word word word word word word |
{8: 2 }two long word long word long word{1:@@@}|
{2:[No Name] [+] }|
{1:<<<}{8: }d word word word word word word^ |
{8: 2 }two long word long word long word lo|
{8: }ng word long word long word long wor|
{8: }d |
{8: 3 }line |
{3:[No Name] [+] }|
|
]])
exec('close')
exec('call DoRel()')
screen:expect([[
2<<<^ong text very long text very long te|
xt very long text very long text ver|
y long text very long text very long|
text very long text very long text |
1 three |
~ |*6
{8:2}{1:<<<}^ong text very long text very long te|
{8: }xt very long text very long text ver|
{8: }y long text very long text very long|
{8: } text very long text very long text |
{8: 1 }three |
{1:~ }|*6
--No lines in buffer-- |
]])
end)
@ -323,22 +325,22 @@ describe('smoothscroll', function()
exe "normal 2Gzt\<C-E>"
]])
screen:expect([[
<<<t very long text very long text very |
{1:<<<}t very long text very long text very |
^long text very long text very long text |
very long text very long text very long |
text very long text- |
text very long text{1:-} |
three |
~ |*2
{1:~ }|*2
|
]])
exec('set listchars+=precedes:#')
screen:expect([[
#ext very long text very long text very |
{1:#}ext very long text very long text very |
^long text very long text very long text |
very long text very long text very long |
text very long text- |
text very long text{1:-} |
three |
~ |*2
{1:~ }|*2
|
]])
end)
@ -356,13 +358,14 @@ describe('smoothscroll', function()
set smoothscroll
diffthis
]])
screen:expect([[
- ^just some text here |
~ |*2
[No Name] [+] |
- just some text here |
~ |
[No Name] [+] |
{7:- }^just some text here |
{1:~ }|*2
{3:[No Name] [+] }|
{7:- }just some text here |
{1:~ }|
{2:[No Name] [+] }|
|
]])
feed('<C-Y>')
@ -380,7 +383,7 @@ describe('smoothscroll', function()
:3
]])
screen:expect([[
<<<h some text with some text |
{1:<<<}h some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
@ -401,7 +404,7 @@ describe('smoothscroll', function()
-- moving cursor up right after the <<< marker - no need to show whole line
feed('2gj3l2k')
screen:expect([[
<<<^h some text with some text |
{1:<<<}^h some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
@ -419,7 +422,7 @@ describe('smoothscroll', function()
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
@ |
{1:@ }|
|
]])
end)
@ -443,7 +446,7 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
<<<th lot^s of text with lots of text wit|
{1:<<<}th lot^s of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@ -452,7 +455,7 @@ describe('smoothscroll', function()
]])
feed('5<C-E>')
screen:expect([[
<<< lots ^of text with lots of text with |
{1:<<<} lots ^of text with lots of text with |
lots of text with lots of text with lots|
of text with lots of text with lots of |
text with lots of text with lots of text|
@ -462,7 +465,7 @@ describe('smoothscroll', function()
-- scrolling down, cursor moves screen line up
feed('5<C-Y>')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@ -482,7 +485,7 @@ describe('smoothscroll', function()
exec('set scrolloff=1')
feed('10|<C-E>')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of^ text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@ -492,7 +495,7 @@ describe('smoothscroll', function()
-- 'scrolloff' set to 1, scrolling down, cursor moves screen line up
feed('<C-E>gjgj<C-Y>')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text wi^th lots of text with lots of te|
@ -503,7 +506,7 @@ describe('smoothscroll', function()
exec('set scrolloff=2')
feed('10|<C-E>')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of tex^t with lots of text with lots o|
f text with lots of text with lots of te|
@ -518,7 +521,7 @@ describe('smoothscroll', function()
exec('set scrolloff=0')
feed('0j')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@ -529,20 +532,20 @@ describe('smoothscroll', function()
feed('zt')
screen:expect([[
^four |
~ |*4
{1:~ }|*4
|
]])
feed('zz')
screen:expect([[
<<<of text with lots of text with lots o|
{1:<<<}of text with lots of text with lots o|
f text with lots of text end |
^four |
~ |*2
{1:~ }|*2
|
]])
feed('zb')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@ -567,7 +570,7 @@ describe('smoothscroll', function()
-- screen.
feed('3Gzt<C-E>j')
screen:expect([[
<<<th lots of text with lots of text wit|
{1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@ -588,16 +591,16 @@ describe('smoothscroll', function()
lots of text with lots of text with lot|
s of text with lots of text with lots of|
text |
~ |
{1:~ }|
|
]]
screen:expect(s1)
feed('<C-E>')
screen:expect([[
<<<ts of text with lots of text with lot|
{1:<<<}ts of text with lots of text with lot|
^s of text with lots of text with lots of|
text |
~ |*2
{1:~ }|*2
|
]])
feed('0')
@ -612,20 +615,20 @@ describe('smoothscroll', function()
exec('set smoothscroll scrolloff=0 showbreak=+++\\ ')
local s1 = [[
^with lots of text in one line with lots |
+++ of text in one line with lots of tex|
+++ t in one line with lots of text in o|
+++ ne line with lots of text in one lin|
+++ e with lots of text in one line |
{1:+++ }of text in one line with lots of tex|
{1:+++ }t in one line with lots of text in o|
{1:+++ }ne line with lots of text in one lin|
{1:+++ }e with lots of text in one line |
|
]]
screen:expect(s1)
feed('<C-E>')
screen:expect([[
+++ ^of text in one line with lots of tex|
+++ t in one line with lots of text in o|
+++ ne line with lots of text in one lin|
+++ e with lots of text in one line |
~ |
{1:+++ }^of text in one line with lots of tex|
{1:+++ }t in one line with lots of text in o|
{1:+++ }ne line with lots of text in one lin|
{1:+++ }e with lots of text in one line |
{1:~ }|
|
]])
feed('0')
@ -642,13 +645,13 @@ describe('smoothscroll', function()
screen:expect([[
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
口口口口口口口口口口 |
~ |*3
{1:~ }|*3
|
]])
feed('<C-E>')
screen:expect([[
<<< 口口口口口口口^口 |
~ |*4
{1:<<<} 口口口口口口口^口 |
{1:~ }|*4
|
]])
end)
@ -694,7 +697,7 @@ describe('smoothscroll', function()
]=])
feed('<C-E>gjgk')
screen:expect([[
<<<lots of text in one line^ |
{1:<<<}lots of text in one line^ |
line two |
line three |
line four |
@ -717,7 +720,7 @@ describe('smoothscroll', function()
call search('xxx')
]=])
screen:expect([[
<<<_____________________________________|
{1:<<<}_____________________________________|
________________________________________|
______________________________________^xx|
x______________________________________x|
@ -744,7 +747,7 @@ describe('smoothscroll', function()
feed('<C-B>G')
-- cursor is not placed below window
screen:expect([[
<<<aaaaaaaaaaaaaaaaa |
{1:<<<}aaaaaaaaaaaaaaaaa |
|*7
^ |
|
@ -901,15 +904,15 @@ describe('smoothscroll', function()
]])
screen:expect([[
|
[No Name] |
{2:[No Name] }|
line1 |
line2 |
^line3line3line3line3line3line3line3line3|
line3line3line3line3line3line3line3line3|
line3line3line3line3 |
line4 |
~ |*2
[No Name] [+] |
{1:~ }|*2
{3:[No Name] [+] }|
|
]])
end)
@ -952,7 +955,7 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
<<<e text with some text with some text with some text |
{1:<<<}e text with some text with some text with some text |
virt_below1 |
virt_above1 |
^Line with some text with some text with some text with |
@ -977,7 +980,7 @@ describe('smoothscroll', function()
some text with some text with some text with some text |
virt_below2 |
virt_above2 |
Line with some text with some text with some text wi@@@|
Line with some text with some text with some text wi{1:@@@}|
|
]])
feed('<C-E>')
@ -992,12 +995,12 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
<<<e text with some text with some text with some tex^t |
{1:<<<}e text with some text with some text with some tex^t |
virt_below2 |
virt_above2 |
Line with some text with some text with some text with |
some text with some text with some text with some text |
~ |
{1:~ }|
|
]])
end)
@ -1010,65 +1013,73 @@ describe('smoothscroll', function()
]])
feed('Go123456789<CR>')
screen:expect([[
<<<ery long line ...A very long line ...|
{1:<<<}ery long line ...A very long line ...|
A very long line ...A very long line ...|*5
123456789 |
^ |
-- INSERT -- |
{5:-- INSERT --} |
]])
end)
it('<<< marker shows with tabline, winbar and splits', function()
screen:try_resize(40, 12)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Blue1, bold = true },
[2] = { reverse = true },
[3] = { bold = true, reverse = true },
[4] = { background = Screen.colors.LightMagenta },
[5] = { bold = true },
[31] = { foreground = Screen.colors.Fuchsia, bold = true },
})
exec([[
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
set smoothscroll scrolloff=0
norm sj
]])
screen:expect([[
<<<e text with some text with some text |
{1:<<<}e text with some text with some text |
with some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
[No Name] [+] |
<<<e text with some text with some text |
{2:[No Name] [+] }|
{1:<<<}e text with some text with some text |
^with some text with some text |
Line with some text with some text with |
some text with some text with some te@@@|
[No Name] [+] |
some text with some text with some te{1:@@@}|
{3:[No Name] [+] }|
|
]])
exec('set showtabline=2')
feed('<C-E>')
screen:expect([[
2+ [No Name] |
<<<e text with some text with some text |
{5: }{31:2}{5:+ [No Name] }{2: }|
{1:<<<}e text with some text with some text |
with some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
[No Name] [+] |
<<<e text with some text with some text |
{2:[No Name] [+] }|
{1:<<<}e text with some text with some text |
^with some text with some text |
Line with some text with some text wi@@@|
[No Name] [+] |
Line with some text with some text wi{1:@@@}|
{3:[No Name] [+] }|
|
]])
exec('set winbar=winbar')
feed('<C-w>k<C-E>')
screen:expect([[
2+ [No Name] |
winbar |
<<<e text with some text with some text |
{5: }{31:2}{5:+ [No Name] }{2: }|
{5:winbar }|
{1:<<<}e text with some text with some text |
^with some text with some text |
Line with some text with some text with |
some text with some text with some te@@@|
[No Name] [+] |
winbar |
<<<e text with some text with some text |
some text with some text with some te{1:@@@}|
{3:[No Name] [+] }|
{5:winbar }|
{1:<<<}e text with some text with some text |
with some text with some text |
[No Name] [+] |
{2:[No Name] [+] }|
|
]])
end)

View File

@ -65,10 +65,10 @@ describe('splitkeep', function()
99 |
^100 |
101 |
[No Name] [+] |
{3:[No Name] [+] }|
5 |
6 |
[No Name] [+] |
{2:[No Name] [+] }|
|
]])
@ -77,10 +77,10 @@ describe('splitkeep', function()
100 |
^101 |
102 |
[No Name] [+] |
{3:[No Name] [+] }|
5 |
6 |
[No Name] [+] |
{2:[No Name] [+] }|
|
]])
@ -90,10 +90,10 @@ describe('splitkeep', function()
198 |
199 |
^200 |
[No Name] [+] |
{3:[No Name] [+] }|
5 |
6 |
[No Name] [+] |
{2:[No Name] [+] }|
|
]])
end)
@ -135,13 +135,13 @@ describe('splitkeep', function()
3 |
4 |
5 |
[No Name] [+] |
{2:[No Name] [+] }|
^7 |
8 |
9 |
10 |
11 |
[No Name] [+] |
{3:[No Name] [+] }|
|
]])
feed(':quit<CR>Ht')
@ -152,13 +152,13 @@ describe('splitkeep', function()
3 |
4 |
5 |
[No Name] [+] |
{3:[No Name] [+] }|
7 |
8 |
9 |
10 |
11 |
[No Name] [+] |
{2:[No Name] [+] }|
:quit |
]])
feed(':set sb<CR>:quit<CR>Gj')
@ -168,14 +168,14 @@ describe('splitkeep', function()
3 |
4 |
^5 |
[No Name] [+] |
{3:[No Name] [+] }|
7 |
8 |
9 |
10 |
11 |
12 |
[No Name] [+] |
{2:[No Name] [+] }|
:quit |
]])
feed(':quit<CR>Gt')
@ -185,14 +185,14 @@ describe('splitkeep', function()
3 |
4 |
5 |
[No Name] [+] |
{2:[No Name] [+] }|
7 |
8 |
9 |
10 |
11 |
^12 |
[No Name] [+] |
{3:[No Name] [+] }|
:quit |
]])
end)
@ -213,70 +213,70 @@ describe('splitkeep', function()
]])
feed('L:wincmd s<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 ^after fold |
[No Name] [+] |
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
[No Name] [+] |
{8: 1 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 8 }after fold |
{8: 9 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 16 }after fold |
{8: 17 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 24 }^after fold |
{3:[No Name] [+] }|
{8: 32 }after fold |
{8: 33 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 40 }after fold |
{8: 41 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 48 }after fold |
{2:[No Name] [+] }|
:wincmd s |
]])
feed(':quit<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 after fold |
25 +-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
49 ^+-- 7 lines: int FuncName() {···················|
{8: 1 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 8 }after fold |
{8: 9 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 16 }after fold |
{8: 17 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 24 }after fold |
{8: 25 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 32 }after fold |
{8: 33 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 40 }after fold |
{8: 41 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 48 }after fold |
{8: 49 }{13:^+-- 7 lines: int FuncName() {···················}|
:quit |
]])
feed('H:below split<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
[No Name] [+] |
25 ^+-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
[No Name] [+] |
{8: 1 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 8 }after fold |
{8: 9 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 16 }after fold |
{8: 17 }{13:+-- 7 lines: int FuncName() {···················}|
{2:[No Name] [+] }|
{8: 25 }{13:^+-- 7 lines: int FuncName() {···················}|
{8: 32 }after fold |
{8: 33 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 40 }after fold |
{8: 41 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 48 }after fold |
{3:[No Name] [+] }|
:below split |
]])
feed(':wincmd k<CR>:quit<CR>')
screen:expect([[
1 +-- 7 lines: int FuncName() {···················|
8 after fold |
9 +-- 7 lines: int FuncName() {···················|
16 after fold |
17 +-- 7 lines: int FuncName() {···················|
24 after fold |
25 ^+-- 7 lines: int FuncName() {···················|
32 after fold |
33 +-- 7 lines: int FuncName() {···················|
40 after fold |
41 +-- 7 lines: int FuncName() {···················|
48 after fold |
49 +-- 7 lines: int FuncName() {···················|
{8: 1 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 8 }after fold |
{8: 9 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 16 }after fold |
{8: 17 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 24 }after fold |
{8: 25 }{13:^+-- 7 lines: int FuncName() {···················}|
{8: 32 }after fold |
{8: 33 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 40 }after fold |
{8: 41 }{13:+-- 7 lines: int FuncName() {···················}|
{8: 48 }after fold |
{8: 49 }{13:+-- 7 lines: int FuncName() {···················}|
:quit |
]])
end)
@ -296,13 +296,13 @@ describe('splitkeep', function()
a |
b |
c |
~ |*4
[No Name] |
{1:~ }|*4
{2:[No Name] }|
^a |
b |
c |
~ |
[No Name] |
{1:~ }|
{3:[No Name] }|
|
]])
end)
@ -317,16 +317,16 @@ describe('splitkeep', function()
wincmd s
]])
screen:expect([[
<<<e line with lots of text in one line |
{1:<<<}e line with lots of text in one line |
with lots of text in one line with lots |
of text in one line |
~ |
[No Name] [+] |
<<<e line with lots of text in one line |
{1:~ }|
{2:[No Name] [+] }|
{1:<<<}e line with lots of text in one line |
^with lots of text in one line with lots |
of text in one line |
~ |*2
[No Name] [+] |
{1:~ }|*2
{3:[No Name] [+] }|
|
]])
end)

View File

@ -22,7 +22,7 @@ describe("'fillchars'", function()
eq('', eval('&fillchars'))
screen:expect([[
^ |
~ |*3
{1:~ }|*3
|
]])
end)
@ -30,13 +30,14 @@ describe("'fillchars'", function()
it('supports whitespace', function()
screen:expect([[
^ |
~ |*3
{1:~ }|*3
|
]])
command('set fillchars=eob:\\ ')
screen:expect([[
^ |
|*4
{1: }|*3
|
]])
end)
@ -44,7 +45,7 @@ describe("'fillchars'", function()
command('set fillchars=eob:ñ')
screen:expect([[
^ |
ñ |*3
{1:ñ }|*3
|
]])
end)
@ -53,7 +54,7 @@ describe("'fillchars'", function()
command('set fillchars=eob:å̲')
screen:expect([[
^ |
å̲ |*3
{1:å̲ }|*3
|
]])
end)
@ -112,8 +113,8 @@ describe("'fillchars'", function()
command('vsplit')
command('set fillchars=fold:x')
screen:expect([[
^+-- 2 lines: fooxxxxxxxx+-- 2 lines: fooxxxxxxx|
~ ~ |*3
{13:^+-- 2 lines: fooxxxxxxxx}│{13:+-- 2 lines: fooxxxxxxx}|
{1:~ }│{1:~ }|*3
|
]])
end)
@ -126,8 +127,8 @@ describe("'fillchars'", function()
command('vsplit')
command('setl fillchars=fold:x')
screen:expect([[
^+-- 2 lines: fooxxxxxxxx+-- 2 lines: foo·······|
~ ~ |*3
{13:^+-- 2 lines: fooxxxxxxxx}│{13:+-- 2 lines: foo·······}|
{1:~ }│{1:~ }|*3
|
]])
end)
@ -141,8 +142,8 @@ describe("'fillchars'", function()
command('vsplit')
command('set fillchars&')
screen:expect([[
^+-- 2 lines: foo········+-- 2 lines: fooxxxxxxx|
~ ~ |*3
{13:^+-- 2 lines: foo········}│{13:+-- 2 lines: fooxxxxxxx}|
{1:~ }│{1:~ }|*3
|
]])
end)
@ -163,8 +164,8 @@ describe("'listchars'", function()
command('vsplit')
command('set listchars=tab:<->')
screen:expect([[
<------><------>^<------> │<------><------><------>|
~ ~ |*3
{1:<------><------>^<------>}{1:<------><------><------>}|
{1:~ }│{1:~ }|*3
|
]])
end)
@ -176,8 +177,8 @@ describe("'listchars'", function()
command('vsplit')
command('setl listchars<')
screen:expect([[
> > ^> │<------><------><------>|
~ ~ |*3
{1:> > ^> }{1:<------><------><------>}|
{1:~ }│{1:~ }|*3
|
]])
end)
@ -189,8 +190,8 @@ describe("'listchars'", function()
command('vsplit')
command('set listchars=tab:>-,eol:$')
screen:expect([[
>------->-------^>-------$<------><------><------>|
~ ~ |*3
{1:>------->-------^>-------$}│{1:<------><------><------>}|
{1:~ }│{1:~ }|*3
|
]])
end)

View File

@ -32,7 +32,7 @@ describe('startup defaults', function()
command('filetype')
screen:expect([[
^ |
~ |*2
{1:~ }|*2
]] .. expected)
end
@ -132,9 +132,9 @@ describe('startup defaults', function()
command('vsp')
screen:expect([[
1 │1 |
^+-- 2 lines: 2··········+-- 2 lines: 2·········|
{13:^+-- 2 lines: 2··········}│{13:+-- 2 lines: 2·········}|
4 │4 |
~ ~ |
{1:~ }│{1:~ }|
|
]])
@ -142,9 +142,9 @@ describe('startup defaults', function()
command('set ambiwidth=double')
screen:expect([[
1 |1 |
^+-- 2 lines: 2----------|+-- 2 lines: 2---------|
{13:^+-- 2 lines: 2----------}|{13:+-- 2 lines: 2---------}|
4 |4 |
~ |~ |
{1:~ }|{1:~ }|
|
]])
@ -152,9 +152,9 @@ describe('startup defaults', function()
fn.setcellwidths({ { 0x2502, 0x2502, 1 } })
screen:expect([[
1 │1 |
^+-- 2 lines: 2----------+-- 2 lines: 2---------|
{13:^+-- 2 lines: 2----------}│{13:+-- 2 lines: 2---------}|
4 │4 |
~ ~ |
{1:~ }│{1:~ }|
|
]])
@ -162,9 +162,9 @@ describe('startup defaults', function()
fn.setcellwidths({ { 0x2502, 0x2502, 2 } })
screen:expect([[
1 |1 |
^+-- 2 lines: 2----------|+-- 2 lines: 2---------|
{13:^+-- 2 lines: 2----------}|{13:+-- 2 lines: 2---------}|
4 |4 |
~ |~ |
{1:~ }|{1:~ }|
|
]])
@ -172,9 +172,9 @@ describe('startup defaults', function()
command('set ambiwidth=single')
screen:expect([[
1 |1 |
^+-- 2 lines: 2··········|+-- 2 lines: 2·········|
{13:^+-- 2 lines: 2··········}|{13:+-- 2 lines: 2·········}|
4 |4 |
~ |~ |
{1:~ }|{1:~ }|
|
]])
end)

View File

@ -22,7 +22,7 @@ describe("'shortmess'", function()
feed(':edit foo<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
"foo" [New] |
]])
eq(1, eval('bufnr("%")'))
@ -31,7 +31,7 @@ describe("'shortmess'", function()
feed(':edit bar<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
:edit bar |
]])
eq(2, eval('bufnr("%")'))
@ -43,21 +43,21 @@ describe("'shortmess'", function()
feed(':edit foo<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
"foo" [New] |
]])
eq(1, eval('bufnr("%")'))
feed(':edit bar<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
"bar" [New] |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
"foo" [New] --No lines in buffer-- |
]])
eq(1, eval('bufnr("%")'))
@ -66,14 +66,14 @@ describe("'shortmess'", function()
feed(':bnext<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
:bnext |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
:bprevious |
]])
eq(1, eval('bufnr("%")'))

View File

@ -166,11 +166,11 @@ describe('health.vim', function()
screen:expect {
grid = [[
^ |
──────────────────────────────────────────────────|
+WE 4 lines: foo: ·······························|
──────────────────────────────────────────────────|
+-- 8 lines: test_plug.success1: require("test_pl|
~ |
{14:──────────────────────────────────────────────────}|
{13:+WE 4 lines: foo: ·······························}|
{14:──────────────────────────────────────────────────}|
{13:+-- 8 lines: test_plug.success1: require("test_pl}|
{1:~ }|
|
]],
}
@ -218,6 +218,12 @@ describe(':checkhealth window', function()
it('opens directly if no buffer created', function()
local screen = Screen.new(50, 12)
screen:set_default_attr_ids {
[1] = { foreground = Screen.colors.Blue, bold = true },
[14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
[31] = { foreground = tonumber('0x6a0dad') },
[32] = { foreground = Screen.colors.PaleGreen2 },
}
screen:attach({ ext_multigrid = true })
command('checkhealth success1')
screen:expect {
@ -227,16 +233,16 @@ describe(':checkhealth window', function()
[3:--------------------------------------------------]|
## grid 2
^ |
──────────────────────────────────────────────────|
──────────────────────────── |
test_plug.success1: require("test_plug.success1. |
health").check() |
{14:──────────────────────────────────────────────────}|
{14:────────────────────────────} |
{31:test_plug.success1: require("test_plug.success1. }|
{31:health").check()} |
|
report 1 |
- OK everything is fine |
{31:report 1} |
- {32:OK} everything is fine |
|
report 2 |
- OK nothing to see here |
{31:report 2} |
- {32:OK} nothing to see here |
## grid 3
|
]],
@ -245,6 +251,12 @@ describe(':checkhealth window', function()
local function test_health_vsplit(left, emptybuf, mods)
local screen = Screen.new(50, 20)
screen:set_default_attr_ids {
[1] = { foreground = Screen.colors.Blue, bold = true },
[14] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
[31] = { foreground = tonumber('0x6a0dad') },
[32] = { foreground = Screen.colors.PaleGreen2 },
}
screen:attach({ ext_multigrid = true })
if not emptybuf then
insert('hello')
@ -257,24 +269,24 @@ describe(':checkhealth window', function()
[3:--------------------------------------------------]|
## grid 2
%s |
~ |*18
{1:~ }|*18
## grid 3
|
## grid 4
^ |
─────────────────────────|*3
─── |
test_plug.success1: |
require("test_plug. |
success1.health").check()|
{14:─────────────────────────}|*3
{14:───} |
{31:test_plug.success1: }|
{31:require("test_plug. }|
{31:success1.health").check()}|
|
report 1 |
- OK everything is fine |
{31:report 1} |
- {32:OK} everything is fine |
|
report 2 |
- OK nothing to see here |
{31:report 2} |
- {32:OK} nothing to see here |
|
~ |*4
{1:~ }|*4
]]):format(
left and '[4:-------------------------]│[2:------------------------]|*19'
or '[2:------------------------]│[4:-------------------------]|*19',
@ -304,6 +316,7 @@ describe(':checkhealth window', function()
local function test_health_split(top, emptybuf, mods)
local screen = Screen.new(50, 25)
screen:attach({ ext_multigrid = true })
screen._default_attr_ids = nil
if not emptybuf then
insert('hello')
end

View File

@ -41,12 +41,12 @@ local grid_without_inlay_hints = [[
]]
local grid_with_inlay_hints = [[
auto add(int a, int b)-> int { return a + b; } |
auto add(int a, int b){1:-> int} { return a + b; } |
|
int main() { |
int x = 1; |
int y = 2; |
return add(a: x,b: y); |
return add({1:a:} x,{1:b:} y); |
} |
^} |
|

View File

@ -121,6 +121,7 @@ it('chansend sends lines to terminal channel in proper order', function()
clear({ args = { '--cmd', 'set laststatus=2' } })
local screen = Screen.new(100, 20)
screen:attach()
screen._default_attr_ids = nil
local shells = is_os('win') and { 'cmd.exe', 'pwsh.exe -nop', 'powershell.exe -nop' } or { 'sh' }
for _, sh in ipairs(shells) do
command([[let id = termopen(']] .. sh .. [[')]])

View File

@ -21,6 +21,7 @@ describe(':terminal', function()
clear()
screen = Screen.new(50, 4)
screen:attach({ rgb = false })
screen._default_attr_ids = nil
end)
it('does not interrupt Press-ENTER prompt #2748', function()
@ -168,6 +169,7 @@ local function test_terminal_with_fake_shell(backslash)
clear()
screen = Screen.new(50, 4)
screen:attach({ rgb = false })
screen._default_attr_ids = nil
api.nvim_set_option_value('shell', shell_path, {})
api.nvim_set_option_value('shellcmdflag', 'EXE', {})
api.nvim_set_option_value('shellxquote', '', {}) -- win: avoid extra quotes

View File

@ -361,16 +361,19 @@ describe(':terminal prints more lines than the screen height and exits', functio
line8 |
line9 |
|
[Process exited 0] |
-- TERMINAL -- |
[Process exited 0]{2: } |
{5:-- TERMINAL --} |
]])
feed('<cr>')
-- closes the buffer correctly after pressing a key
screen:expect([[
screen:expect {
grid = [[
^ |
~ |*5
{1:~ }|*5
|
]])
]],
attr_ids = { [1] = { foreground = 12 } },
}
end)
end)

View File

@ -204,7 +204,7 @@ describe('ui/cursor', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
test |
]],
condition = function()
@ -290,7 +290,7 @@ describe('ui/cursor', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
test |
]],
condition = function()

View File

@ -2680,6 +2680,7 @@ it('pager works in headless mode with UI attached', function()
local child_session = helpers.connect(child_server)
local child_screen = Screen.new(40, 6)
child_screen:attach(nil, child_session)
child_screen._default_attr_ids = nil -- TODO: unskip with new color scheme
child_session:notify('nvim_command', [[echo range(100)->join("\n")]])
child_screen:expect([[

View File

@ -256,28 +256,28 @@ describe('shell command :!', function()
:!'Write-Output $a' |
Write-Output $a |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
feed_command([[!$a = 1; Write-Output '$a']])
screen:expect([[
:!$a = 1; Write-Output '$a' |
$a |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
feed_command([[!"Write-Output $a"]])
screen:expect([[
:!"Write-Output $a" |
Write-Output |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
feed_command([[!$a = 1; Write-Output "$a"]])
screen:expect([[
:!$a = 1; Write-Output "$a" |
1 |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
if is_os('win') then
feed_command([[!& 'cmd.exe' /c 'echo $a']])
@ -285,7 +285,7 @@ describe('shell command :!', function()
:!& 'cmd.exe' /c 'echo $a' |
$a |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
else
feed_command([[!& '/bin/sh' -c 'echo ''$a''']])
@ -293,7 +293,7 @@ describe('shell command :!', function()
:!& '/bin/sh' -c 'echo ''$a''' |
$a |
|
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
end
end)

View File

@ -139,6 +139,43 @@ local function _init_colors()
end
Screen.colors = colors
Screen.colornames = colornames
Screen._global_default_attr_ids = {
[1] = { foreground = Screen.colors.Blue1, bold = true },
[2] = { reverse = true },
[3] = { bold = true, reverse = true },
[4] = { background = Screen.colors.LightMagenta },
[5] = { bold = true },
[6] = { foreground = Screen.colors.SeaGreen, bold = true },
[7] = { background = Screen.colors.Gray, foreground = Screen.colors.DarkBlue },
[8] = { foreground = Screen.colors.Brown },
[9] = { background = Screen.colors.Red, foreground = Screen.colors.Grey100 },
[10] = { background = Screen.colors.Yellow },
[11] = {
foreground = Screen.colors.Blue1,
background = Screen.colors.LightMagenta,
bold = true,
},
[12] = { background = Screen.colors.Gray },
[13] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue },
[14] = { background = Screen.colors.DarkGray, foreground = Screen.colors.LightGrey },
[15] = { foreground = Screen.colors.Brown, bold = true },
[16] = { foreground = Screen.colors.SlateBlue },
[17] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
[18] = { foreground = Screen.colors.Blue1 },
[19] = { foreground = Screen.colors.Red },
[20] = { background = Screen.colors.Yellow, foreground = Screen.colors.Red },
[21] = { background = Screen.colors.Grey90 },
[22] = { background = Screen.colors.LightBlue },
[23] = { foreground = Screen.colors.Blue1, background = Screen.colors.LightCyan, bold = true },
[24] = { background = Screen.colors.LightGrey, underline = true },
[25] = { foreground = Screen.colors.Cyan4 },
[26] = { foreground = Screen.colors.Fuchsia },
[27] = { background = Screen.colors.Red, bold = true },
[28] = { foreground = Screen.colors.SlateBlue, underline = true },
[29] = { foreground = Screen.colors.SlateBlue, bold = true },
[30] = { background = Screen.colors.Red },
}
end
--- @param width? integer
@ -257,6 +294,10 @@ function Screen:attach(options, session)
if self._options.ext_multigrid then
self._options.ext_linegrid = true
end
if self._default_attr_ids == nil then
self._default_attr_ids = Screen._global_default_attr_ids
end
end
function Screen:detach()
@ -480,7 +521,10 @@ function Screen:expect(expected, attr_ids, ...)
attr_state.id_to_index = self:linegrid_check_attrs(attr_state.ids or {})
end
local actual_rows = self:render(not expected.any, attr_state)
local actual_rows
if expected.any or grid then
actual_rows = self:render(not expected.any, attr_state)
end
if expected.any then
-- Search for `any` anywhere in the screen lines.

View File

@ -27,38 +27,38 @@ describe('statuscolumn', function()
[[set stc=%{v:relnum?v:relnum:(v:lnum==5?'truncate':v:lnum)}%{!v:relnum&&v:lnum==5?invalid:''}\ ]]
)
screen:expect([[
4 aaaaa |
3 aaaaa |
2 aaaaa |
1 aaaaa |
8 ^aaaaa |
1 aaaaa |
2 aaaaa |
3 aaaaa |
4 aaaaa |
5 aaaaa |
6 aaaaa |
7 aaaaa |
8 aaaaa |
{8:4 }aaaaa |
{8:3 }aaaaa |
{8:2 }aaaaa |
{8:1 }aaaaa |
{8:8 }^aaaaa |
{8:1 }aaaaa |
{8:2 }aaaaa |
{8:3 }aaaaa |
{8:4 }aaaaa |
{8:5 }aaaaa |
{8:6 }aaaaa |
{8:7 }aaaaa |
{8:8 }aaaaa |
|
]])
command('norm 5G')
eq('Vim(redraw):E121: Undefined variable: invalid', pcall_err(command, 'redraw!'))
eq('', eval('&statuscolumn'))
screen:expect([[
4 aaaaa |
5 ^aaaaa |
6 aaaaa |
7 aaaaa |
8 aaaaa |
9 aaaaa |
10 aaaaa |
11 aaaaa |
12 aaaaa |
13 aaaaa |
14 aaaaa |
15 aaaaa |
16 aaaaa |
{8: 4 }aaaaa |
{8: 5 }^aaaaa |
{8: 6 }aaaaa |
{8: 7 }aaaaa |
{8: 8 }aaaaa |
{8: 9 }aaaaa |
{8:10 }aaaaa |
{8:11 }aaaaa |
{8:12 }aaaaa |
{8:13 }aaaaa |
{8:14 }aaaaa |
{8:15 }aaaaa |
{8:16 }aaaaa |
|
]])
end)
@ -72,9 +72,9 @@ describe('statuscolumn', function()
norm 5G | redraw!
]=])
screen:expect([[
1 aaaaa virt_text |
bbbbba^eaaa |
1 aaaaa |
{8:1 }aaaaa virt_text |
{8:bbbbb}a^eaaa |
{8:1 }aaaaa |
|
]])
-- Doesn't crash when trying to fill click defs that do not fit (#26845)
@ -84,9 +84,9 @@ describe('statuscolumn', function()
norm 5Gzt | redraw!
]=])
screen:expect([[
bbbbba^eaaa |
1 aaaaa |
2 aaaaa |
{8:bbbbb}a^eaaa |
{8:1 }aaaaa |
{8:2 }aaaaa |
|
]])
end)
@ -94,19 +94,19 @@ describe('statuscolumn', function()
it("works with 'number' and 'relativenumber'", function()
command([[set stc=%{&nu?v:lnum:''}%=%{&rnu?'\ '.v:relnum:''}│]])
screen:expect([[
4 │aaaaa |
5 │aaaaa |
6 │aaaaa |
7 │aaaaa |
8 │^aaaaa |
9 │aaaaa |
10│aaaaa |
11│aaaaa |
12│aaaaa |
13│aaaaa |
14│aaaaa |
15│aaaaa |
16│aaaaa |
{8:4 │}aaaaa |
{8:5 │}aaaaa |
{8:6 │}aaaaa |
{8:7 │}aaaaa |
{8:8 │}^aaaaa |
{8:9 │}aaaaa |
{8:10│}aaaaa |
{8:11│}aaaaa |
{8:12│}aaaaa |
{8:13│}aaaaa |
{8:14│}aaaaa |
{8:15│}aaaaa |
{8:16│}aaaaa |
|
]])
command([[set stc=%l%=%{&rnu?'\ ':''}%r│]])
@ -114,39 +114,19 @@ describe('statuscolumn', function()
command([[set stc=%{&nu?v:lnum:''}%=%{&rnu?'\ '.v:relnum:''}│]])
command('set relativenumber')
screen:expect([[
4 4│aaaaa |
5 3│aaaaa |
6 2│aaaaa |
7 1│aaaaa |
8 0│^aaaaa |
9 1│aaaaa |
10 2│aaaaa |
11 3│aaaaa |
12 4│aaaaa |
13 5│aaaaa |
14 6│aaaaa |
15 7│aaaaa |
16 8│aaaaa |
|
]])
command([[set stc=%l%=%{&rnu?'\ ':''}%r│]])
screen:expect_unchanged()
command([[set stc=%{&nu?v:lnum:''}%=%{&rnu?'\ '.v:relnum:''}│]])
command('norm 12GH')
screen:expect([[
4 0│^aaaaa |
5 1│aaaaa |
6 2│aaaaa |
7 3│aaaaa |
8 4│aaaaa |
9 5│aaaaa |
10 6│aaaaa |
11 7│aaaaa |
12 8│aaaaa |
13 9│aaaaa |
14 10│aaaaa |
15 11│aaaaa |
16 12│aaaaa |
{8:4 4│}aaaaa |
{8:5 3│}aaaaa |
{8:6 2│}aaaaa |
{8:7 1│}aaaaa |
{8:8 0│}^aaaaa |
{8:9 1│}aaaaa |
{8:10 2│}aaaaa |
{8:11 3│}aaaaa |
{8:12 4│}aaaaa |
{8:13 5│}aaaaa |
{8:14 6│}aaaaa |
{8:15 7│}aaaaa |
{8:16 8│}aaaaa |
|
]])
command([[set stc=%l%=%{&rnu?'\ ':''}%r│]])
@ -735,19 +715,19 @@ describe('statuscolumn', function()
virt_lines_leftcol = true, virt_lines = {{{"virt", ""}}} })
]])
screen:expect([[
4 aaaaa |
5 aaaaa |
6 aaaaa |
7 aaaaa |
{7: }{8: 4 }aaaaa |
{7: }{8: 5 }aaaaa |
{7: }{8: 6 }aaaaa |
{7: }{8: 7 }aaaaa |
virt |
--------- 8 ^aaaaa |
{7:---------}{8: 8 }^aaaaa |
virt |
𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀 9 aaaaa |
10 aaaaa |
11 aaaaa |
12 aaaaa |
13 aaaaa |
14 aaaaa |
{7:𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀𒀀}{8: 9 }aaaaa |
{7: }{8:10 }aaaaa |
{7: }{8:11 }aaaaa |
{7: }{8:12 }aaaaa |
{7: }{8:13 }aaaaa |
{7: }{8:14 }aaaaa |
|
]])
command('set stc=') -- also for the default fold column
@ -756,18 +736,18 @@ describe('statuscolumn', function()
command([[set stc=%{foldlevel(v:lnum)>0?repeat('-',foldlevel(v:lnum)):''}%=%l\ ]])
feed('Gd10Ggg<C-l>')
screen:expect([[
1 ^aaaaa |
2 aaaaa |
3 aaaaa |
4 aaaaa |
5 aaaaa |
6 aaaaa |
7 aaaaa |
{8: 1 }^aaaaa |
{8: 2 }aaaaa |
{8: 3 }aaaaa |
{8: 4 }aaaaa |
{8: 5 }aaaaa |
{8: 6 }aaaaa |
{8: 7 }aaaaa |
virt |
---------8 aaaaa |
{8:---------8 }aaaaa |
virt |
---------9 aaaaa |
~ |*2
{8:---------9 }aaaaa |
{1:~ }|*2
|
]])
end)
@ -775,15 +755,15 @@ describe('statuscolumn', function()
it('works with cmdwin', function()
feed(':set stc=%l<CR>q:k$')
screen:expect([[
7 aaaaa |
8 aaaaa |
9 aaaaa |
10aaaaa |
[No Name] [+] |
:1set stc=%^l |
:2 |
~ |*5
[Command Line] |
{8:7 }aaaaa |
{8:8 }aaaaa |
{8:9 }aaaaa |
{8:10}aaaaa |
{2:[No Name] [+] }|
{1::}{8:1}set stc=%^l |
{1::}{8:2} |
{1:~ }|*5
{3:[Command Line] }|
: |
]])
end)
@ -794,11 +774,11 @@ describe('statuscolumn', function()
command('set relativenumber')
command([[set stc=%{!&nu&&!&rnu?'':&rnu?v:relnum?v:relnum:&nu?v:lnum:'0':v:lnum}]])
screen:expect([[
1 aaaaa |
8 ^aaaaa |
1 aaaaa |
2 aaaaa |
3 aaaaa |
{8:1 }aaaaa |
{8:8 }^aaaaa |
{8:1 }aaaaa |
{8:2 }aaaaa |
{8:3 }aaaaa |
|
]])
-- width correctly estimated with "w_nrwidth_line_count" when setting 'stc'
@ -815,11 +795,11 @@ describe('statuscolumn', function()
-- width correctly estimated with "w_nrwidth_line_count" when setting 'nu'
command('set number')
screen:expect([[
7 aaaaa |
8 ^aaaaa |
9 aaaaa |
10 aaaaa |
11 aaaaa |
{8:7 }aaaaa |
{8:8 }^aaaaa |
{8:9 }aaaaa |
{8:10 }aaaaa |
{8:11 }aaaaa |
|
]])
end)
@ -846,59 +826,59 @@ describe('statuscolumn', function()
]])
command('sign place 1 line=2 name=sign')
screen:expect([[
1 ^aaaaa |
2 ssaaaaa |
{8:1 }^aaaaa |
{8:2 ss}aaaaa |
|
]])
command('sign place 2 line=2 name=sign')
screen:expect([[
1 ^aaaaa |
2 ssssaaaaa |
{8:1 }^aaaaa |
{8:2 ssss}aaaaa |
|
]])
command('sign unplace 2')
screen:expect([[
1 ^aaaaa |
2 ssaaaaa |
{8:1 }^aaaaa |
{8:2 ss}aaaaa |
|
]])
command('sign unplace 1')
screen:expect([[
1 ^aaaaa |
2 aaaaa |
{8:1 }^aaaaa |
{8:2 }aaaaa |
|
]])
-- Also for extmark signs
exec_lua('id1 = vim.api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text = "ss"})')
screen:expect([[
1 ^aaaaa |
2 ssaaaaa |
{8:1 }^aaaaa |
{8:2 ss}aaaaa |
|
]])
exec_lua('id2 = vim.api.nvim_buf_set_extmark(0, ns, 1, 0, {sign_text = "ss"})')
screen:expect([[
1 ^aaaaa |
2 ssssaaaaa |
{8:1 }^aaaaa |
{8:2 ssss}aaaaa |
|
]])
exec_lua('vim.api.nvim_buf_del_extmark(0, ns, id1)')
screen:expect([[
1 ^aaaaa |
2 ssaaaaa |
{8:1 }^aaaaa |
{8:2 ss}aaaaa |
|
]])
exec_lua('vim.api.nvim_buf_del_extmark(0, ns, id2)')
screen:expect([[
1 ^aaaaa |
2 aaaaa |
{8:1 }^aaaaa |
{8:2 }aaaaa |
|
]])
-- In all windows
command('wincmd v | set ls=0')
command('sign place 1 line=2 name=sign')
screen:expect([[
1 ^aaaaa │1 aaaaa |
2 ssaaaaa │2 ssaaaaa |
{8:1 }^aaaaa │{8:1 }aaaaa |
{8:2 ss}aaaaa │{8:2 ss}aaaaa |
|
]])
end)
@ -918,12 +898,16 @@ describe('statuscolumn', function()
it('does not wrap multibyte characters at the end of a line', function()
screen:try_resize(33, 4)
screen:set_default_attr_ids {
[8] = { foreground = Screen.colors.Brown },
[31] = { undercurl = true, special = Screen.colors.Red },
}
command([[set spell stc=%l\ ]])
command('call setline(8, "This is a line that contains ᶏ multibyte character.")')
screen:expect([[
8 ^This is a line that contains |
multibyte character. |
9 aaaaa |
{8:8 }^This is a line that contains {31:ᶏ}|
{8: } {31:multibyte} character. |
{8:9 }{31:aaaaa} |
|
]])
end)
@ -934,9 +918,9 @@ describe('statuscolumn', function()
command('call setline(1, range(1, 99))')
feed('Gyyp')
screen:expect([[
98 98 |
99 99 |
100 ^99 |
{8:98 }98 |
{8:99 }99 |
{8:100 }^99 |
|
]])
end)

View File

@ -596,57 +596,59 @@ it('statusline is redrawn on various state changes', function()
command('set ls=2 stl=%{repeat(reg_recording(),5)}')
screen:expect([[
^ |
~ |
|*2
{1:~ }|
{3: }|
|
]])
feed('qQ')
screen:expect([[
^ |
~ |
QQQQQ |
recording @Q |
{1:~ }|
{3:QQQQQ }|
{5:recording @Q} |
]])
feed('q')
screen:expect([[
^ |
~ |
|*2
{1:~ }|
{3: }|
|
]])
-- Visual mode change #23932
command('set ls=2 stl=%{mode(1)}')
screen:expect([[
^ |
~ |
n |
{1:~ }|
{3:n }|
|
]])
feed('v')
screen:expect([[
^ |
~ |
v |
-- VISUAL -- |
{1:~ }|
{3:v }|
{5:-- VISUAL --} |
]])
feed('V')
screen:expect([[
^ |
~ |
V |
-- VISUAL LINE -- |
{1:~ }|
{3:V }|
{5:-- VISUAL LINE --} |
]])
feed('<C-V>')
screen:expect([[
^ |
~ |
^V |
-- VISUAL BLOCK -- |
{1:~ }|
{3:^V }|
{5:-- VISUAL BLOCK --} |
]])
feed('<Esc>')
screen:expect([[
^ |
~ |
n |
{1:~ }|
{3:n }|
|
]])
end)

View File

@ -31,7 +31,7 @@ describe('ui/ext_tabline', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
|
]],
condition = function()
@ -44,7 +44,7 @@ describe('ui/ext_tabline', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
|
]],
condition = function()
@ -62,7 +62,7 @@ describe('ui/ext_tabline', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
|
]],
condition = function()
@ -81,7 +81,7 @@ describe('ui/ext_tabline', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
|
]],
condition = function()

View File

@ -14,6 +14,13 @@ describe("'wildmenu'", function()
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:set_default_attr_ids {
[1] = { foreground = Screen.colors.Blue, bold = true },
[2] = { reverse = true },
[3] = { bold = true, reverse = true },
[5] = { bold = true },
[31] = { foreground = Screen.colors.Grey0, background = Screen.colors.Yellow },
}
screen:attach()
end)
@ -105,14 +112,14 @@ describe("'wildmenu'", function()
feed(':sign <tab>')
screen:expect([[
|
~ |*2
define jump list > |
{1:~ }|*2
{31:define}{3: jump list > }|
:sign define^ |
]])
feed('<C-E>')
screen:expect([[
|
~ |*3
{1:~ }|*3
:sign ^ |
]])
end)
@ -121,14 +128,14 @@ describe("'wildmenu'", function()
feed(':sign <tab>')
screen:expect([[
|
~ |*2
define jump list > |
{1:~ }|*2
{31:define}{3: jump list > }|
:sign define^ |
]])
feed('<tab><C-Y>')
screen:expect([[
|
~ |*3
{1:~ }|*3
:sign jump^ |
]])
end)
@ -138,8 +145,8 @@ describe("'wildmenu'", function()
feed(':sign <tab>')
screen:expect([[
|
~ |*2
define jump list > |
{1:~ }|*2
{31:define}{3: jump list > }|
:sign define^ |
]])
end)
@ -152,15 +159,15 @@ describe("'wildmenu'", function()
feed(':sign <tab>')
screen:expect([[
|
~ |*2
define jump list > |
{1:~ }|*2
{31:define}{3: jump list > }|
:sign define^ |
]])
feed('<space>')
screen:expect([[
|
~ |*2
[No Name] |
{1:~ }|*2
{3:[No Name] }|
:sign define ^ |
]])
end)
@ -170,16 +177,16 @@ describe("'wildmenu'", function()
feed(':j<Tab><Tab><Tab>')
screen:expect([[
|
~ |*2
join jumps |
{1:~ }|*2
{3:join jumps }|
:j^ |
]])
-- This would cause nvim to crash before #6650
feed('<BS><Tab>')
screen:expect([[
|
~ |*2
! # & < = > @ > |
{1:~ }|*2
{31:!}{3: # & < = > @ > }|
:!^ |
]])
end)
@ -192,7 +199,7 @@ describe("'wildmenu'", function()
feed([[:sign <Tab>]]) -- Invoke wildmenu.
-- NB: in earlier versions terminal output was redrawn during cmdline mode.
-- For now just assert that the screen remains unchanged.
screen:expect { any = 'define jump list > |\n:sign define^ |' }
screen:expect { any = '{31:define}{3: jump list > }|\n:sign define^ |' }
screen:expect_unchanged()
-- cmdline CTRL-D display should also be preserved.
@ -222,8 +229,8 @@ describe("'wildmenu'", function()
screen:expect {
grid = [[
|
~ |*2
define jump list > |
{1:~ }|*2
{31:define}{3: jump list > }|
:sign define^ |
]],
}
@ -252,7 +259,7 @@ describe("'wildmenu'", function()
feed([[:<Tab>]]) -- Invoke wildmenu.
-- Check only the last 2 lines, because the shell output is
-- system-dependent.
screen:expect { any = '! # & < = > @ > |\n:!^' }
screen:expect { any = '{31:!}{3: # & < = > @ > }|\n:!^' }
-- Because this test verifies a _lack_ of activity, we must wait the full timeout.
-- So make it reasonable.
screen:expect_unchanged(false, 1000)
@ -266,27 +273,29 @@ describe("'wildmenu'", function()
command('set showtabline=2')
feed(':set wildm<tab>')
screen:expect([[
[No Name] |
|
~ |
{5: [No Name] }{2: }|
|
{1:~ }|
{3: }|
:set wildm |
wildmenu wildmode |
:set wildm^ |
]])
feed('<tab>') -- trigger wildmode full
screen:expect([[
[No Name] |
|*2
{5: [No Name] }{2: }|
|
{3: }|
:set wildm |
wildmenu wildmode |*2
wildmenu wildmode |
{31:wildmenu}{3: wildmode }|
:set wildmenu^ |
]])
feed('<Esc>')
screen:expect([[
[No Name] |
{5: [No Name] }{2: }|
^ |
~ |*4
{1:~ }|*4
|
]])
end)
@ -301,14 +310,14 @@ describe("'wildmenu'", function()
feed(':sign u<tab>')
screen:expect([[
|
~ |*5
{1:~ }|*5
:sign un^ |
]])
feed('<tab>') -- trigger wildmode list
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
:sign un |
undefine unplace |
:sign un^ |
@ -316,7 +325,7 @@ describe("'wildmenu'", function()
feed('<Esc>')
screen:expect([[
^ |
~ |*5
{1:~ }|*5
|
]])
@ -324,8 +333,8 @@ describe("'wildmenu'", function()
feed(':sign un<tab>')
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
:sign un |
undefine unplace |
:sign un^ |
@ -335,7 +344,7 @@ describe("'wildmenu'", function()
feed('<Esc>')
screen:expect([[
^ |
~ |*5
{1:~ }|*5
|
]])
end)
@ -348,8 +357,8 @@ describe("'wildmenu'", function()
feed(':sign u<tab>')
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
:sign u |
undefine unplace |
:sign u^ |
@ -357,8 +366,8 @@ describe("'wildmenu'", function()
feed('<tab>') -- trigger wildmode longest
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
:sign u |
undefine unplace |
:sign un^ |
@ -366,7 +375,7 @@ describe("'wildmenu'", function()
feed('<Esc>')
screen:expect([[
^ |
~ |*5
{1:~ }|*5
|
]])
end)
@ -379,15 +388,16 @@ describe("'wildmenu'", function()
feed('<c-d>')
screen:expect([[
|
~ |*2
|
{1:~ }|*2
{3: }|
:set wildm |
wildmenu wildmode |
:set wildm^ |
]])
feed('<c-d>')
screen:expect([[
|*2
|
{3: }|
:set wildm |
wildmenu wildmode |
:set wildm |
@ -397,8 +407,8 @@ describe("'wildmenu'", function()
feed('<Esc>')
screen:expect([[
^ |
~ |*4
[No Name] |
{1:~ }|*4
{3:[No Name] }|
|
]])
end)
@ -594,7 +604,7 @@ describe('ui/ext_wildmenu', function()
screen:expect {
grid = [[
|
~ |*3
{1:~ }|*3
:sign define^ |
]],
wildmenu_items = expected,
@ -605,7 +615,7 @@ describe('ui/ext_wildmenu', function()
screen:expect {
grid = [[
|
~ |*3
{1:~ }|*3
:sign jump^ |
]],
wildmenu_items = expected,
@ -616,7 +626,7 @@ describe('ui/ext_wildmenu', function()
screen:expect {
grid = [[
|
~ |*3
{1:~ }|*3
:sign ^ |
]],
wildmenu_items = expected,
@ -627,7 +637,7 @@ describe('ui/ext_wildmenu', function()
screen:expect {
grid = [[
|
~ |*3
{1:~ }|*3
:sign define^ |
]],
wildmenu_items = expected,
@ -638,7 +648,7 @@ describe('ui/ext_wildmenu', function()
screen:expect {
grid = [[
|
~ |*3
{1:~ }|*3
:sign definea^ |
]],
}

View File

@ -191,21 +191,21 @@ describe('execute()', function()
feed([[:call Test1()<cr>]])
screen:expect([[
^ |
~ |*4
{1:~ }|*4
ABCD |
]])
feed([[:call Test2()<cr>]])
screen:expect([[
^ |
~ |*4
{1:~ }|*4
1234ABCD |
]])
feed([[:call Test3()<cr>]])
screen:expect([[
^ |
~ |*4
{1:~ }|*4
1234ABCDXZYZ |
]])
@ -215,39 +215,39 @@ describe('execute()', function()
-- "ef" was overwritten since msg_col was recovered wrongly
screen:expect([[
1234 |
Error detected while processing function|
Test4: |
line 2: |
abcdABCD |
Press ENTER or type command to continue^ |
{9:Error detected while processing function}|
{9: Test4:} |
{8:line 2:} |
{9:abcd}ABCD |
{6:Press ENTER or type command to continue}^ |
]])
feed([[<cr>]]) -- to clear screen
feed([[:call Test5()<cr>]])
screen:expect([[
^ |
~ |*4
{1:~ }|*4
1234ABCD |
]])
feed([[:call Test6()<cr>]])
screen:expect([[
|
Error detected while processing function|
Test6: |
line 2: |
E121ABCD |
Press ENTER or type command to continue^ |
{9:Error detected while processing function}|
{9: Test6:} |
{8:line 2:} |
{9:E121}ABCD |
{6:Press ENTER or type command to continue}^ |
]])
feed([[:call Test7()<cr>]])
screen:expect([[
Error detected while processing function|
Test6: |
line 2: |
E121ABCD |
{9:Error detected while processing function}|
{9: Test6:} |
{8:line 2:} |
{9:E121}ABCD |
ABCD |
Press ENTER or type command to continue^ |
{6:Press ENTER or type command to continue}^ |
]])
end)
@ -265,7 +265,7 @@ describe('execute()', function()
command('let g:mes = execute("echon 42", "")')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
42 |
]])
eq('42', eval('g:mes'))
@ -289,7 +289,7 @@ describe('execute()', function()
command('let g:mes = execute("echon 42")')
screen:expect([[
^ |
~ |*3
{1:~ }|*3
|
]])
eq('42', eval('g:mes'))
@ -298,7 +298,7 @@ describe('execute()', function()
screen:expect {
grid = [[
^ |
~ |*3
{1:~ }|*3
|
]],
unchanged = true,

View File

@ -214,7 +214,7 @@ describe('system()', function()
feed(':call system("echo")<cr>')
screen:expect([[
^ |
~ |*12
{1:~ }|*12
:call system("echo") |
]])
end)
@ -262,14 +262,14 @@ describe('system()', function()
)
screen:expect([[
|
~ |*12
{1:~ }|*12
]] .. (is_os('win') and [[
:call system("for /L %I in (1,0,2) do @echo y") |]] or [[
:call system("yes") |]]))
feed('foo<c-c>')
screen:expect([[
^ |
~ |*12
{1:~ }|*12
Type :qa and press <Enter> to exit Nvim |
]])
end)
@ -283,15 +283,15 @@ describe('system()', function()
)
screen:expect([[
|
~ |*12
{1:~ }|*12
]] .. (is_os('win') and [[
:call system("for /L %I in (1,0,2) do @echo y") |]] or [[
:call system("yes") |]]))
feed('foo<c-c>')
screen:expect([[
^ |
~ |*12
-- INSERT -- |
{1:~ }|*12
{5:-- INSERT --} |
]])
end)
end)
@ -447,7 +447,7 @@ describe('systemlist()', function()
feed(':call systemlist("echo")<cr>')
screen:expect([[
^ |
~ |*12
{1:~ }|*12
:call systemlist("echo") |
]])
end)
@ -456,13 +456,13 @@ describe('systemlist()', function()
feed(':call systemlist("yes | xargs")<cr>')
screen:expect([[
|
~ |*12
{1:~ }|*12
:call systemlist("yes | xargs") |
]])
feed('<c-c>')
screen:expect([[
^ |
~ |*12
{1:~ }|*12
Type :qa and press <Enter> to exit Nvim |
]])
end)