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

This commit is contained in:
bfredl 2024-03-27 10:35:50 +01:00
parent 63f7b1f31e
commit b556bd1a53
30 changed files with 580 additions and 857 deletions

View File

@ -12,10 +12,6 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
it('is working', function() it('is working', function()
local screen = Screen.new(40, 5) local screen = Screen.new(40, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.Red },
})
command('highlight MyGroup1 term=bold ctermbg=red guibg=red') command('highlight MyGroup1 term=bold ctermbg=red guibg=red')
command('highlight MyGroup2 term=italic ctermbg=green guibg=green') command('highlight MyGroup2 term=italic ctermbg=green guibg=green')
@ -25,8 +21,8 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
insert('abcdefghijklmnopq') insert('abcdefghijklmnopq')
command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)") command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
screen:expect([[ screen:expect([[
abcd{1:e}fg{1:hij}klmnop^q | abcd{30:e}fg{30:hij}klmnop^q |
{0:~ }|*3 {1:~ }|*3
| |
]]) ]])
@ -34,8 +30,8 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
command("call setline(1, 'abcdΣabcdef')") command("call setline(1, 'abcdΣabcdef')")
command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])") command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
screen:expect([[ screen:expect([[
abc{1:}ab{1:cd}e^f | abc{30:}ab{30:cd}e^f |
{0:~ }|*3 {1:~ }|*3
| |
]]) ]])
end) end)

View File

@ -67,50 +67,43 @@ describe('breakindent', function()
setlocal breakindent setlocal breakindent
call setline(1, "\t" .. join(range(100))) call setline(1, "\t" .. join(range(100)))
]]) ]])
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true, reverse = true }, -- StatusLine
[3] = { reverse = true }, -- StatusLineNC
[4] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
feed('v$') feed('v$')
screen:expect([[ screen:expect([[
{0:<<<} {1: 93 94 95 96 97 98 99}^ | {1:<<<} {17: 93 94 95 96 97 98 99}^ |
{2:[No Name] [+] }| {3:[No Name] [+] }|
| |
{0:~ }| {1:~ }|
{3:[No Name] }| {2:[No Name] }|
{4:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
command('setlocal showbreak=+++') command('setlocal showbreak=+++')
screen:expect([[ screen:expect([[
{0:+++}{1: 90 91 92 93 94 95 96 97 98 99}^ | {1:+++}{17: 90 91 92 93 94 95 96 97 98 99}^ |
{2:[No Name] [+] }| {3:[No Name] [+] }|
| |
{0:~ }| {1:~ }|
{3:[No Name] }| {2:[No Name] }|
{4:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
command('setlocal breakindentopt+=sbr') command('setlocal breakindentopt+=sbr')
screen:expect([[ screen:expect([[
{0:+++} {1: 93 94 95 96 97 98 99}^ | {1:+++} {17: 93 94 95 96 97 98 99}^ |
{2:[No Name] [+] }| {3:[No Name] [+] }|
| |
{0:~ }| {1:~ }|
{3:[No Name] }| {2:[No Name] }|
{4:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
command('setlocal nobreakindent') command('setlocal nobreakindent')
screen:expect([[ screen:expect([[
{0:+++}{1: 98 99}^ | {1:+++}{17: 98 99}^ |
{2:[No Name] [+] }| {3:[No Name] [+] }|
| |
{0:~ }| {1:~ }|
{3:[No Name] }| {2:[No Name] }|
{4:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
end) end)
end) end)

View File

@ -15,12 +15,6 @@ describe('cmdline', function()
it('is cleared when switching tabs', function() it('is cleared when switching tabs', function()
local screen = Screen.new(30, 10) local screen = Screen.new(30, 10)
screen:attach() screen:attach()
screen:set_default_attr_ids {
[1] = { underline = true, background = Screen.colors.LightGrey },
[2] = { bold = true },
[3] = { reverse = true },
[4] = { bold = true, foreground = Screen.colors.Blue1 },
}
feed_command([[call setline(1, range(30))]]) feed_command([[call setline(1, range(30))]])
screen:expect([[ screen:expect([[
@ -39,9 +33,9 @@ describe('cmdline', function()
feed [[:tabnew<cr>]] feed [[:tabnew<cr>]]
screen:expect { screen:expect {
grid = [[ grid = [[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}| {24: + [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{4:~ }|*7 {1:~ }|*7
:tabnew | :tabnew |
]], ]],
} }
@ -49,9 +43,9 @@ describe('cmdline', function()
feed [[<C-w>-<C-w>-]] feed [[<C-w>-<C-w>-]]
screen:expect { screen:expect {
grid = [[ grid = [[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}| {24: + [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{4:~ }|*5 {1:~ }|*5
|*3 |*3
]], ]],
} }
@ -59,7 +53,7 @@ describe('cmdline', function()
feed [[gt]] feed [[gt]]
screen:expect { screen:expect {
grid = [[ grid = [[
{2: + [No Name] }{1: [No Name] }{3: }{1:X}| {5: + [No Name] }{24: [No Name] }{2: }{24:X}|
^0 | ^0 |
1 | 1 |
2 | 2 |
@ -74,9 +68,9 @@ describe('cmdline', function()
feed [[gt]] feed [[gt]]
screen:expect([[ screen:expect([[
{1: + [No Name] }{2: [No Name] }{3: }{1:X}| {24: + [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{4:~ }|*5 {1:~ }|*5
|*3 |*3
]]) ]])
end) end)
@ -109,10 +103,6 @@ describe('cmdline', function()
-- oldtest: Test_cmdline_redraw_tabline() -- oldtest: Test_cmdline_redraw_tabline()
it('tabline is redrawn on entering cmdline', function() it('tabline is redrawn on entering cmdline', function()
local screen = Screen.new(30, 6) local screen = Screen.new(30, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true }, -- TabLineFill
})
screen:attach() screen:attach()
exec([[ exec([[
set showtabline=2 set showtabline=2
@ -120,9 +110,9 @@ describe('cmdline', function()
]]) ]])
feed(':') feed(':')
screen:expect([[ screen:expect([[
{1:foo }| {2:foo }|
| |
{0:~ }|*3 {1:~ }|*3
:^ | :^ |
]]) ]])
end) end)
@ -130,9 +120,6 @@ describe('cmdline', function()
-- oldtest: Test_redraw_in_autocmd() -- oldtest: Test_redraw_in_autocmd()
it('cmdline cursor position is correct after :redraw with cmdheight=2', function() it('cmdline cursor position is correct after :redraw with cmdheight=2', function()
local screen = Screen.new(30, 6) local screen = Screen.new(30, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
exec([[ exec([[
set cmdheight=2 set cmdheight=2
@ -141,7 +128,7 @@ describe('cmdline', function()
feed(':for i in range(3)<CR>') feed(':for i in range(3)<CR>')
screen:expect([[ screen:expect([[
| |
{0:~ }|*3 {1:~ }|*3
:for i in range(3) | :for i in range(3) |
: ^ | : ^ |
]]) ]])
@ -149,7 +136,7 @@ describe('cmdline', function()
-- Note: this may still be considered broken, ref #18140 -- Note: this may still be considered broken, ref #18140
screen:expect([[ screen:expect([[
| |
{0:~ }|*3 {1:~ }|*3
: :let i =^ | : :let i =^ |
| |
]]) ]])
@ -157,10 +144,6 @@ describe('cmdline', function()
it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function() it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, reverse = true }, -- StatusLine
})
screen:attach() screen:attach()
exec([[ exec([[
set cmdheight=1 laststatus=2 set cmdheight=1 laststatus=2
@ -175,15 +158,15 @@ describe('cmdline', function()
feed(':call EchoTwo()') feed(':call EchoTwo()')
screen:expect([[ screen:expect([[
| |
{0:~ }|*5 {1:~ }|*5
{1:[No Name] }| {3:[No Name] }|
:call EchoTwo()^ | :call EchoTwo()^ |
]]) ]])
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*5 {1:~ }|*5
{1:[No Name] }| {3:[No Name] }|
| |
]]) ]])
end) end)
@ -191,21 +174,15 @@ describe('cmdline', function()
-- oldtest: Test_cmdheight_tabline() -- oldtest: Test_cmdheight_tabline()
it("changing 'cmdheight' when there is a tabline", function() it("changing 'cmdheight' when there is a tabline", function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, reverse = true }, -- StatusLine
[2] = { bold = true }, -- TabLineSel
[3] = { reverse = true }, -- TabLineFill
})
screen:attach() screen:attach()
api.nvim_set_option_value('laststatus', 2, {}) api.nvim_set_option_value('laststatus', 2, {})
api.nvim_set_option_value('showtabline', 2, {}) api.nvim_set_option_value('showtabline', 2, {})
api.nvim_set_option_value('cmdheight', 1, {}) api.nvim_set_option_value('cmdheight', 1, {})
screen:expect([[ screen:expect([[
{2: [No Name] }{3: }| {5: [No Name] }{2: }|
^ | ^ |
{0:~ }|*4 {1:~ }|*4
{1:[No Name] }| {3:[No Name] }|
| |
]]) ]])
end) end)
@ -213,9 +190,6 @@ describe('cmdline', function()
-- oldtest: Test_rulerformat_position() -- oldtest: Test_rulerformat_position()
it("ruler has correct position with 'rulerformat' set", function() it("ruler has correct position with 'rulerformat' set", function()
local screen = Screen.new(20, 3) local screen = Screen.new(20, 3)
screen:set_default_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
}
screen:attach() screen:attach()
api.nvim_set_option_value('ruler', true, {}) api.nvim_set_option_value('ruler', true, {})
api.nvim_set_option_value('rulerformat', 'longish', {}) api.nvim_set_option_value('rulerformat', 'longish', {})
@ -224,7 +198,7 @@ describe('cmdline', function()
feed [[<C-W>v<C-W>|<C-W>p]] feed [[<C-W>v<C-W>|<C-W>p]]
screen:expect [[ screen:expect [[
^ | ^ |
{0:~ }{0:~}| {1:~ }{1:~}|
longish | longish |
]] ]]
end) end)

View File

@ -19,12 +19,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_two_windows() -- oldtest: Test_conceal_two_windows()
it('works', function() it('works', function()
local screen = Screen.new(75, 12) local screen = Screen.new(75, 12)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, reverse = true }, -- StatusLine
[2] = { reverse = true }, -- StatusLineNC, IncSearch
[3] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
exec([[ exec([[
let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"] let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
@ -48,12 +42,12 @@ describe('Conceal', function()
two ^here | two ^here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three three | three three |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
/here | /here |
]]) ]])
@ -65,12 +59,12 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three three | three three |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
/here | /here |
]]) ]])
@ -83,12 +77,12 @@ describe('Conceal', function()
two |hidden| ^here | two |hidden| ^here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three three | three three |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
/here | /here |
]]) ]])
@ -100,12 +94,12 @@ describe('Conceal', function()
two here | two here |
three |hidden^| three | three |hidden^| three |
Second window | Second window |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three three | three three |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
/here | /here |
]]) ]])
@ -117,13 +111,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| ^here | two |hidden| ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
/here | /here |
]]) ]])
@ -134,13 +128,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two ^here | two ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
/here | /here |
]]) ]])
feed('a') feed('a')
@ -149,14 +143,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h^ere | two |hidden| h^ere |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>/e') feed('<Esc>/e')
screen:expect([[ screen:expect([[
@ -164,13 +158,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h{2:e}re | two |hidden| h{2:e}re |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
/e^ | /e^ |
]]) ]])
feed('<Esc>v') feed('<Esc>v')
@ -179,14 +173,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| ^here | two |hidden| ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
@ -197,13 +191,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| ^here | two |hidden| ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
]]) ]])
feed('a') feed('a')
@ -212,14 +206,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two h^ere | two h^ere |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>/e') feed('<Esc>/e')
screen:expect([[ screen:expect([[
@ -227,13 +221,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h{2:e}re | two |hidden| h{2:e}re |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
/e^ | /e^ |
]]) ]])
feed('<Esc>v') feed('<Esc>v')
@ -242,14 +236,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| ^here | two |hidden| ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
@ -260,13 +254,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| ^here | two |hidden| ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
]]) ]])
feed('a') feed('a')
@ -275,14 +269,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h^ere | two |hidden| h^ere |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>/e') feed('<Esc>/e')
screen:expect([[ screen:expect([[
@ -290,13 +284,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h{2:e}re | two |hidden| h{2:e}re |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
/e^ | /e^ |
]]) ]])
feed('<Esc>v') feed('<Esc>v')
@ -305,14 +299,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two ^here | two ^here |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
@ -324,14 +318,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two |hidden| h^ere | two |hidden| h^ere |
three three | three three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Down>') feed('<Down>')
screen:expect([[ screen:expect([[
@ -339,14 +333,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three |hidden|^ three | three |hidden|^ three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
@ -356,13 +350,13 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three |hidden^| three | three |hidden^| three |
{0:~ }| {1:~ }|
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
]]) ]])
feed('o') feed('o')
@ -371,14 +365,14 @@ describe('Conceal', function()
two here | two here |
three three | three three |
Second window | Second window |
{0:~ }| {1:~ }|
{2:[No Name] [+] }| {2:[No Name] [+] }|
one one one one one | one one one one one |
two here | two here |
three three | three three |
^ | ^ |
{1:[No Name] [+] }| {3:[No Name] [+] }|
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
end) end)
@ -499,10 +493,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_resize_term() -- oldtest: Test_conceal_resize_term()
it('resize editor', function() it('resize editor', function()
local screen = Screen.new(75, 6) local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { foreground = Screen.colors.Blue }, -- Comment
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed') call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed')
@ -512,14 +502,14 @@ describe('Conceal', function()
]]) ]])
screen:expect([[ screen:expect([[
one two three four five, the ^backticks should be concealed | one two three four five, the ^backticks should be concealed |
{0:~ }|*4 {1:~ }|*4
| |
]]) ]])
screen:try_resize(75, 7) screen:try_resize(75, 7)
screen:expect([[ screen:expect([[
one two three four five, the ^backticks should be concealed | one two three four five, the ^backticks should be concealed |
{0:~ }|*5 {1:~ }|*5
| |
]]) ]])
end) end)
@ -527,9 +517,6 @@ describe('Conceal', function()
-- oldtest: Test_conceal_linebreak() -- oldtest: Test_conceal_linebreak()
it('with linebreak', function() it('with linebreak', function()
local screen = Screen.new(75, 8) local screen = Screen.new(75, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
exec([[ exec([[
let &wrap = v:true let &wrap = v:true
@ -549,9 +536,9 @@ describe('Conceal', function()
^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
| |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{0:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | {1:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
{0:+ }cccccc | {1:+ }cccccc |
{0:~ }|*2 {1:~ }|*2
| |
]]) ]])
end) end)

View File

@ -12,10 +12,6 @@ describe('debugger', function()
before_each(function() before_each(function()
screen = Screen.new(999, 10) screen = Screen.new(999, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { reverse = true, bold = true },
})
screen:attach() screen:attach()
end) end)
@ -33,7 +29,7 @@ describe('debugger', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^let g:Xtest_var += 1{MATCH: *}| ^let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}|*8 {1:~{MATCH: *}}|*8
:source %{MATCH: *}| :source %{MATCH: *}|
]], ]],
} }
@ -41,8 +37,8 @@ describe('debugger', function()
screen:expect { screen:expect {
grid = [[ grid = [[
let g:Xtest_var += 1{MATCH: *}| let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}| {1:~{MATCH: *}}|
{1:{MATCH: *}}| {3:{MATCH: *}}|
Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}| Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}|
Entering Debug mode. Type "cont" to continue.{MATCH: *}| Entering Debug mode. Type "cont" to continue.{MATCH: *}|
Oldval = "10"{MATCH: *}| Oldval = "10"{MATCH: *}|
@ -56,7 +52,7 @@ describe('debugger', function()
screen:expect { screen:expect {
grid = [[ grid = [[
^let g:Xtest_var += 1{MATCH: *}| ^let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}|*8 {1:~{MATCH: *}}|*8
{MATCH: *}| {MATCH: *}|
]], ]],
} }
@ -64,8 +60,8 @@ describe('debugger', function()
screen:expect { screen:expect {
grid = [[ grid = [[
let g:Xtest_var += 1{MATCH: *}| let g:Xtest_var += 1{MATCH: *}|
{0:~{MATCH: *}}| {1:~{MATCH: *}}|
{1:{MATCH: *}}| {3:{MATCH: *}}|
Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}| Breakpoint in "{MATCH:.*}XdebugBreakExpr.vim" line 1{MATCH: *}|
Entering Debug mode. Type "cont" to continue.{MATCH: *}| Entering Debug mode. Type "cont" to continue.{MATCH: *}|
Oldval = "11"{MATCH: *}| Oldval = "11"{MATCH: *}|

View File

@ -9,29 +9,24 @@ describe('digraph', function()
-- oldtest: Test_entering_digraph() -- oldtest: Test_entering_digraph()
it('characters displayed on the screen', function() it('characters displayed on the screen', function()
local screen = Screen.new(10, 6) local screen = Screen.new(10, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { foreground = Screen.colors.Blue }, -- SpecialKey
[2] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
feed('i<C-K>') feed('i<C-K>')
screen:expect([[ screen:expect([[
{1:^?} | {18:^?} |
{0:~ }|*4 {1:~ }|*4
{2:-- INSERT --}| {5:-- INSERT --}|
]]) ]])
feed('1') feed('1')
screen:expect([[ screen:expect([[
{1:^1} | {18:^1} |
{0:~ }|*4 {1:~ }|*4
{2:-- INSERT --}| {5:-- INSERT --}|
]]) ]])
feed('2') feed('2')
screen:expect([[ screen:expect([[
½^ | ½^ |
{0:~ }|*4 {1:~ }|*4
{2:-- INSERT --}| {5:-- INSERT --}|
]]) ]])
end) end)
end) end)

View File

@ -13,9 +13,6 @@ describe('display', function()
it('scroll when modified at topline vim-patch:8.2.1488', function() it('scroll when modified at topline vim-patch:8.2.1488', function()
local screen = Screen.new(20, 4) local screen = Screen.new(20, 4)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true },
})
command([[call setline(1, repeat('a', 21))]]) command([[call setline(1, repeat('a', 21))]])
feed('O') feed('O')
@ -23,7 +20,7 @@ describe('display', function()
^ | ^ |
aaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaa|
a | a |
{1:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)
@ -31,11 +28,6 @@ describe('display', function()
it('scrolling when modified at topline in Visual mode vim-patch:8.2.4626', function() it('scrolling when modified at topline in Visual mode vim-patch:8.2.4626', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true }, -- ModeMsg
[2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[3] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
})
exec([[ exec([[
set scrolloff=0 set scrolloff=0
@ -47,9 +39,9 @@ describe('display', function()
]]) ]])
feed('VG7kk') feed('VG7kk')
screen:expect([[ screen:expect([[
{3: }^f{2:oo} | {7: }^f{17:oo} |
{3: }foo |*6 {7: }foo |*6
{1:-- VISUAL LINE --} | {5:-- VISUAL LINE --} |
]]) ]])
end) end)

View File

@ -30,22 +30,17 @@ describe('edit', function()
-- oldtest: Test_edit_insert_reg() -- oldtest: Test_edit_insert_reg()
it('inserting a register using CTRL-R', function() it('inserting a register using CTRL-R', function()
local screen = Screen.new(10, 6) local screen = Screen.new(10, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { foreground = Screen.colors.Blue }, -- SpecialKey
[2] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
feed('a<C-R>') feed('a<C-R>')
screen:expect([[ screen:expect([[
{1:^"} | {18:^"} |
{0:~ }|*4 {1:~ }|*4
{2:-- INSERT --}| {5:-- INSERT --}|
]]) ]])
feed('=') feed('=')
screen:expect([[ screen:expect([[
{1:"} | {18:"} |
{0:~ }|*4 {1:~ }|*4
=^ | =^ |
]]) ]])
end) end)
@ -53,51 +48,42 @@ describe('edit', function()
-- oldtest: Test_edit_ctrl_r_failed() -- oldtest: Test_edit_ctrl_r_failed()
it('positioning cursor after CTRL-R expression failed', function() it('positioning cursor after CTRL-R expression failed', function()
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { foreground = Screen.colors.Blue }, -- SpecialKey
[2] = { foreground = Screen.colors.SlateBlue },
[3] = { bold = true }, -- ModeMsg
[4] = { reverse = true, bold = true }, -- MsgSeparator
[5] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
[6] = { foreground = Screen.colors.SeaGreen, bold = true }, -- MoreMsg
})
screen:attach() screen:attach()
feed('i<C-R>') feed('i<C-R>')
screen:expect([[ screen:expect([[
{1:^"} | {18:^"} |
{0:~ }|*4 {1:~ }|*4
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('={}') feed('={}')
screen:expect([[ screen:expect([[
{1:"} | {18:"} |
{0:~ }|*4 {1:~ }|*4
={2:{}}^ | ={16:{}}^ |
]]) ]])
-- trying to insert a dictionary produces an error -- trying to insert a dictionary produces an error
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
{1:"} | {18:"} |
{0:~ }| {1:~ }|
{4: }| {3: }|
={2:{}} | ={16:{}} |
{5:E731: Using a Dictionary as a String} | {9:E731: Using a Dictionary as a String} |
{6:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed(':') feed(':')
screen:expect([[ screen:expect([[
:^ | :^ |
{0:~ }|*4 {1:~ }|*4
{3:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
-- ending Insert mode should put the cursor back on the ':' -- ending Insert mode should put the cursor back on the ':'
feed('<Esc>') feed('<Esc>')
screen:expect([[ screen:expect([[
^: | ^: |
{0:~ }|*4 {1:~ }|*4
| |
]]) ]])
end) end)

View File

@ -45,60 +45,55 @@ describe('Ex mode', function()
it('substitute confirmation prompt', function() it('substitute confirmation prompt', function()
command('set noincsearch nohlsearch inccommand=') command('set noincsearch nohlsearch inccommand=')
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, reverse = true }, -- MsgSeparator
[1] = { foreground = Screen.colors.Brown }, -- LineNr
[2] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
command([[call setline(1, ['foo foo', 'foo foo', 'foo foo'])]]) command([[call setline(1, ['foo foo', 'foo foo', 'foo foo'])]])
command([[set number]]) command([[set number]])
feed('gQ') feed('gQ')
screen:expect([[ screen:expect([[
{1: 1 }foo foo | {8: 1 }foo foo |
{1: 2 }foo foo | {8: 2 }foo foo |
{1: 3 }foo foo | {8: 3 }foo foo |
{0: }| {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. | Entering Ex mode. Type "visual" to go to Normal mode. |
:^ | :^ |
]]) ]])
feed('%s/foo/bar/gc<CR>') feed('%s/foo/bar/gc<CR>')
screen:expect([[ screen:expect([[
{1: 1 }foo foo | {8: 1 }foo foo |
{0: }| {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. | Entering Ex mode. Type "visual" to go to Normal mode. |
:%s/foo/bar/gc | :%s/foo/bar/gc |
{1: 1 }foo foo | {8: 1 }foo foo |
^^^^ | ^^^^ |
]]) ]])
feed('N<CR>') feed('N<CR>')
screen:expect([[ screen:expect([[
Entering Ex mode. Type "visual" to go to Normal mode. | Entering Ex mode. Type "visual" to go to Normal mode. |
:%s/foo/bar/gc | :%s/foo/bar/gc |
{1: 1 }foo foo | {8: 1 }foo foo |
^^^N | ^^^N |
{1: 1 }foo foo | {8: 1 }foo foo |
^^^^ | ^^^^ |
]]) ]])
feed('n<CR>') feed('n<CR>')
screen:expect([[ screen:expect([[
{1: 1 }foo foo | {8: 1 }foo foo |
^^^N | ^^^N |
{1: 1 }foo foo | {8: 1 }foo foo |
^^^n | ^^^n |
{1: 1 }foo foo | {8: 1 }foo foo |
^^^^ | ^^^^ |
]]) ]])
feed('y<CR>') feed('y<CR>')
feed('q<CR>') feed('q<CR>')
screen:expect([[ screen:expect([[
{1: 1 }foo foo | {8: 1 }foo foo |
^^^y | ^^^y |
{1: 2 }foo foo | {8: 2 }foo foo |
^^^q | ^^^q |
{1: 2 }foo foo | {8: 2 }foo foo |
:^ | :^ |
]]) ]])
@ -106,35 +101,31 @@ describe('Ex mode', function()
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
^^^y | ^^^y |
{1: 2 }foo foo | {8: 2 }foo foo |
^^^q | ^^^q |
{1: 2 }foo foo | {8: 2 }foo foo |
{1: 3 }foo foo | {8: 3 }foo foo |
:^ | :^ |
]]) ]])
feed(':vi<CR>') feed(':vi<CR>')
screen:expect([[ screen:expect([[
{1: 1 }foo bar | {8: 1 }foo bar |
{1: 2 }foo foo | {8: 2 }foo foo |
{1: 3 }^foo foo | {8: 3 }^foo foo |
{2:~ }|*2 {1:~ }|*2
| |
]]) ]])
end) end)
it('pressing Ctrl-C in :append inside a loop in Ex mode does not hang', function() it('pressing Ctrl-C in :append inside a loop in Ex mode does not hang', function()
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, reverse = true }, -- MsgSeparator
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
feed('gQ') feed('gQ')
feed('for i in range(1)<CR>') feed('for i in range(1)<CR>')
feed('append<CR>') feed('append<CR>')
screen:expect([[ screen:expect([[
{0: }| {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. | Entering Ex mode. Type "visual" to go to Normal mode. |
:for i in range(1) | :for i in range(1) |
| |

View File

@ -48,12 +48,6 @@ describe(':confirm command dialog', function()
local function start_new() local function start_new()
clear() clear()
screen = Screen.new(75, 20) screen = Screen.new(75, 20)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, reverse = true }, -- StatusLine, MsgSeparator
[2] = { reverse = true }, -- StatusLineNC
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach() screen:attach()
end end
@ -76,17 +70,17 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n') feed(':confirm qall\n')
screen:expect([[ screen:expect([[
bar2 | bar2 |
{0:~ }|*5 {1:~ }|*5
{2:Xbar [+] }| {2:Xbar [+] }|
foo2 | foo2 |
{0:~ }|*4 {1:~ }|*4
{2:Xfoo [+] }| {2:Xfoo [+] }|
| |
{0:~ }|*2 {1:~ }|*2
{1: }| {3: }|
:confirm qall | :confirm qall |
{3:Save changes to "Xbar"?} | {6:Save changes to "Xbar"?} |
{3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ |
]]) ]])
expect_exit(1000, feed, 'A') expect_exit(1000, feed, 'A')
@ -106,17 +100,17 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n') feed(':confirm qall\n')
screen:expect([[ screen:expect([[
bar3 | bar3 |
{0:~ }|*5 {1:~ }|*5
{2:Xbar [+] }| {2:Xbar [+] }|
foo3 | foo3 |
{0:~ }|*4 {1:~ }|*4
{2:Xfoo [+] }| {2:Xfoo [+] }|
| |
{0:~ }|*2 {1:~ }|*2
{1: }| {3: }|
:confirm qall | :confirm qall |
{3:Save changes to "Xbar"?} | {6:Save changes to "Xbar"?} |
{3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ |
]]) ]])
expect_exit(1000, feed, 'D') expect_exit(1000, feed, 'D')
@ -136,33 +130,33 @@ describe(':confirm command dialog', function()
feed(':confirm qall\n') feed(':confirm qall\n')
screen:expect([[ screen:expect([[
bar4 | bar4 |
{0:~ }|*5 {1:~ }|*5
{2:Xbar [+] }| {2:Xbar [+] }|
foo4 | foo4 |
{0:~ }|*4 {1:~ }|*4
{2:Xfoo [+] }| {2:Xfoo [+] }|
| |
{0:~ }|*2 {1:~ }|*2
{1: }| {3: }|
:confirm qall | :confirm qall |
{3:Save changes to "Xbar"?} | {6:Save changes to "Xbar"?} |
{3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ |
]]) ]])
feed('N') feed('N')
screen:expect([[ screen:expect([[
bar4 | bar4 |
{0:~ }|*5 {1:~ }|*5
{2:Xbar [+] }| {2:Xbar [+] }|
foo4 | foo4 |
{0:~ }|*4 {1:~ }|*4
{2:Xfoo [+] }| {2:Xfoo [+] }|
| |
{1: }| {3: }|
:confirm qall | :confirm qall |
{3:Save changes to "Xbar"?} | {6:Save changes to "Xbar"?} |
| |
{3:Save changes to "Xfoo"?} | {6:Save changes to "Xfoo"?} |
{3:[Y]es, (N)o, (C)ancel: }^ | {6:[Y]es, (N)o, (C)ancel: }^ |
]]) ]])
expect_exit(1000, feed, 'Y') expect_exit(1000, feed, 'Y')
@ -186,39 +180,39 @@ describe(':confirm command dialog', function()
feed(':confirm close\n') feed(':confirm close\n')
screen:expect([[ screen:expect([[
abc | abc |
{0:~ }|*3 {1:~ }|*3
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
{1: }| {3: }|
:confirm close | :confirm close |
{3:Save changes to "Untitled"?} | {6:Save changes to "Untitled"?} |
{3:[Y]es, (N)o, (C)ancel: }^ | {6:[Y]es, (N)o, (C)ancel: }^ |
]]) ]])
feed('C') feed('C')
screen:expect([[ screen:expect([[
^abc | ^abc |
{0:~ }|*3 {1:~ }|*3
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
{0:~ }|*2 {1:~ }|*2
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
feed(':confirm close\n') feed(':confirm close\n')
screen:expect([[ screen:expect([[
abc | abc |
{0:~ }|*3 {1:~ }|*3
{1:[No Name] [+] }| {3:[No Name] [+] }|
| |
{1: }| {3: }|
:confirm close | :confirm close |
{3:Save changes to "Untitled"?} | {6:Save changes to "Untitled"?} |
{3:[Y]es, (N)o, (C)ancel: }^ | {6:[Y]es, (N)o, (C)ancel: }^ |
]]) ]])
feed('N') feed('N')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*8 {1:~ }|*8
| |
]]) ]])
end) end)
@ -237,16 +231,16 @@ describe(':confirm command dialog', function()
feed(':confirm q\n') feed(':confirm q\n')
screen:expect([[ screen:expect([[
foo | foo |
{0:~ }|*3 {1:~ }|*3
{1: }| {3: }|
:confirm q | :confirm q |
{3:Save changes to "Untitled"?} | {6:Save changes to "Untitled"?} |
{3:[Y]es, (N)o, (C)ancel: }^ | {6:[Y]es, (N)o, (C)ancel: }^ |
]]) ]])
feed('C') feed('C')
screen:expect([[ screen:expect([[
^abc | ^abc |
{0:~ }|*6 {1:~ }|*6
| |
]]) ]])
@ -254,16 +248,16 @@ describe(':confirm command dialog', function()
feed(':confirm wq\n') feed(':confirm wq\n')
screen:expect([[ screen:expect([[
foo | foo |
{0:~ }|*3 {1:~ }|*3
{1: }| {3: }|
"Xfoo" [noeol] 1L, 3B written | "Xfoo" [noeol] 1L, 3B written |
{3:Save changes to "Untitled"?} | {6:Save changes to "Untitled"?} |
{3:[Y]es, (N)o, (C)ancel: }^ | {6:[Y]es, (N)o, (C)ancel: }^ |
]]) ]])
feed('C') feed('C')
screen:expect([[ screen:expect([[
^abc | ^abc |
{0:~ }|*6 {1:~ }|*6
"Xfoo" [noeol] 1L, 3B written | "Xfoo" [noeol] 1L, 3B written |
]]) ]])
@ -286,17 +280,17 @@ describe(':confirm command dialog', function()
feed(':set ro | confirm w\n') feed(':set ro | confirm w\n')
screen:expect([[ screen:expect([[
foobar | foobar |
{0:~ }|*2 {1:~ }|*2
{1: }| {3: }|
:set ro | confirm w | :set ro | confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} | {6:'readonly' option is set for "Xconfirm_write_ro".} |
{3:Do you wish to write anyway?} | {6:Do you wish to write anyway?} |
{3:(Y)es, [N]o: }^ | {6:(Y)es, [N]o: }^ |
]]) ]])
feed('N') feed('N')
screen:expect([[ screen:expect([[
fooba^r | fooba^r |
{0:~ }|*5 {1:~ }|*5
| |
1,6 All | 1,6 All |
]]) ]])
@ -305,35 +299,35 @@ describe(':confirm command dialog', function()
feed(':confirm w\n') feed(':confirm w\n')
screen:expect([[ screen:expect([[
foobar | foobar |
{0:~ }|*2 {1:~ }|*2
{1: }| {3: }|
:confirm w | :confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} | {6:'readonly' option is set for "Xconfirm_write_ro".} |
{3:Do you wish to write anyway?} | {6:Do you wish to write anyway?} |
{3:(Y)es, [N]o: }^ | {6:(Y)es, [N]o: }^ |
]]) ]])
feed('Y') feed('Y')
if is_os('win') then if is_os('win') then
screen:expect([[ screen:expect([[
foobar | foobar |
{0:~ }| {1:~ }|
{1: }| {3: }|
:confirm w | :confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} | {6:'readonly' option is set for "Xconfirm_write_ro".} |
{3:Do you wish to write anyway?} | {6:Do you wish to write anyway?} |
"Xconfirm_write_ro" [unix] 1L, 7B written | "Xconfirm_write_ro" [unix] 1L, 7B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
else else
screen:expect([[ screen:expect([[
foobar | foobar |
{0:~ }| {1:~ }|
{1: }| {3: }|
:confirm w | :confirm w |
{3:'readonly' option is set for "Xconfirm_write_ro".} | {6:'readonly' option is set for "Xconfirm_write_ro".} |
{3:Do you wish to write anyway?} | {6:Do you wish to write anyway?} |
"Xconfirm_write_ro" 1L, 7B written | "Xconfirm_write_ro" 1L, 7B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
end end
eq('foobar\n', read_file('Xconfirm_write_ro')) eq('foobar\n', read_file('Xconfirm_write_ro'))
@ -344,36 +338,36 @@ describe(':confirm command dialog', function()
feed(':set noro | silent undo | confirm w\n') feed(':set noro | silent undo | confirm w\n')
screen:expect([[ screen:expect([[
foobar | foobar |
{0:~ }| {1:~ }|
{1: }| {3: }|
:set noro | silent undo | confirm w | :set noro | silent undo | confirm w |
{3:File permissions of "Xconfirm_write_ro" are read-only.} | {6:File permissions of "Xconfirm_write_ro" are read-only.} |
{3:It may still be possible to write it.} | {6:It may still be possible to write it.} |
{3:Do you wish to try?} | {6:Do you wish to try?} |
{3:(Y)es, [N]o: }^ | {6:(Y)es, [N]o: }^ |
]]) ]])
feed('Y') feed('Y')
if is_os('win') then if is_os('win') then
screen:expect([[ screen:expect([[
foobar | foobar |
{1: }| {3: }|
:set noro | silent undo | confirm w | :set noro | silent undo | confirm w |
{3:File permissions of "Xconfirm_write_ro" are read-only.} | {6:File permissions of "Xconfirm_write_ro" are read-only.} |
{3:It may still be possible to write it.} | {6:It may still be possible to write it.} |
{3:Do you wish to try?} | {6:Do you wish to try?} |
"Xconfirm_write_ro" [unix] 1L, 4B written | "Xconfirm_write_ro" [unix] 1L, 4B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
else else
screen:expect([[ screen:expect([[
foobar | foobar |
{1: }| {3: }|
:set noro | silent undo | confirm w | :set noro | silent undo | confirm w |
{3:File permissions of "Xconfirm_write_ro" are read-only.} | {6:File permissions of "Xconfirm_write_ro" are read-only.} |
{3:It may still be possible to write it.} | {6:It may still be possible to write it.} |
{3:Do you wish to try?} | {6:Do you wish to try?} |
"Xconfirm_write_ro" 1L, 4B written | "Xconfirm_write_ro" 1L, 4B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
end end
eq('foo\n', read_file('Xconfirm_write_ro')) eq('foo\n', read_file('Xconfirm_write_ro'))
@ -399,10 +393,10 @@ describe(':confirm command dialog', function()
b | b |
c | c |
d | d |
{1: }| {3: }|
:confirm 2,3w | :confirm 2,3w |
{3:Write partial file?} | {6:Write partial file?} |
{3:(Y)es, [N]o: }^ | {6:(Y)es, [N]o: }^ |
]]) ]])
feed('N') feed('N')
screen:expect([[ screen:expect([[
@ -410,7 +404,7 @@ describe(':confirm command dialog', function()
b | b |
c | c |
d | d |
{0:~ }|*2 {1:~ }|*2
| |
1,1 All | 1,1 All |
]]) ]])
@ -423,10 +417,10 @@ describe(':confirm command dialog', function()
b | b |
c | c |
d | d |
{1: }| {3: }|
:confirm 2,3w | :confirm 2,3w |
{3:Write partial file?} | {6:Write partial file?} |
{3:(Y)es, [N]o: }^ | {6:(Y)es, [N]o: }^ |
]]) ]])
feed('Y') feed('Y')
if is_os('win') then if is_os('win') then
@ -434,22 +428,22 @@ describe(':confirm command dialog', function()
a | a |
b | b |
c | c |
{1: }| {3: }|
:confirm 2,3w | :confirm 2,3w |
{3:Write partial file?} | {6:Write partial file?} |
"Xwrite_partial" [New][unix] 2L, 4B written | "Xwrite_partial" [New][unix] 2L, 4B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
else else
screen:expect([[ screen:expect([[
a | a |
b | b |
c | c |
{1: }| {3: }|
:confirm 2,3w | :confirm 2,3w |
{3:Write partial file?} | {6:Write partial file?} |
"Xwrite_partial" [New] 2L, 4B written | "Xwrite_partial" [New] 2L, 4B written |
{3:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
end end
eq('b\nc\n', read_file('Xwrite_partial')) eq('b\nc\n', read_file('Xwrite_partial'))

View File

@ -14,12 +14,6 @@ describe('folding', function()
helpers.clear() helpers.clear()
screen = Screen.new(45, 8) screen = Screen.new(45, 8)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, -- Folded
[3] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey }, -- FoldColumn
[4] = { foreground = Screen.colors.Brown }, -- LineNr
})
screen:attach() screen:attach()
end) end)
@ -222,15 +216,15 @@ describe('folding', function()
command('call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])') command('call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])')
screen:expect([[ screen:expect([[
{3:+ }{4: 0 }{2:^+-- 2 lines: ·························}| {7:+ }{8: 0 }{13:^+-- 2 lines: ·························}|
{3:+ }{4: 1 }{2:+-- 2 lines: ·························}| {7:+ }{8: 1 }{13:+-- 2 lines: ·························}|
{1:~ }|*5 {1:~ }|*5
| |
]]) ]])
feed('j') feed('j')
screen:expect([[ screen:expect([[
{3:+ }{4: 1 }{2:+-- 2 lines: ·························}| {7:+ }{8: 1 }{13:+-- 2 lines: ·························}|
{3:+ }{4: 0 }{2:^+-- 2 lines: ·························}| {7:+ }{8: 0 }{13:^+-- 2 lines: ·························}|
{1:~ }|*5 {1:~ }|*5
| |
]]) ]])
@ -246,7 +240,7 @@ describe('folding', function()
screen:expect([[ screen:expect([[
^one | ^one |
{2:+-- 2 lines: two····························}| {13:+-- 2 lines: two····························}|
four | four |
{1:~ }|*4 {1:~ }|*4
| |
@ -263,7 +257,7 @@ describe('folding', function()
feed('4G') feed('4G')
screen:expect([[ screen:expect([[
one | one |
{2:+-- 2 lines: two····························}| {13:+-- 2 lines: two····························}|
^four | ^four |
{1:~ }|*4 {1:~ }|*4
| |
@ -280,7 +274,7 @@ describe('folding', function()
feed('1G') feed('1G')
screen:expect([[ screen:expect([[
^one | ^one |
{2:+-- 2 lines: two····························}| {13:+-- 2 lines: two····························}|
four | four |
{1:~ }|*4 {1:~ }|*4
| |
@ -297,7 +291,7 @@ describe('folding', function()
feed('k') feed('k')
screen:expect([[ screen:expect([[
^one | ^one |
{2:+-- 2 lines: two····························}| {13:+-- 2 lines: two····························}|
four | four |
{1:~ }|*4 {1:~ }|*4
| |

View File

@ -11,10 +11,6 @@ describe(':global', function()
-- oldtest: Test_interrupt_global() -- oldtest: Test_interrupt_global()
it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function() it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function()
local screen = Screen.new(75, 6) local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, reverse = true }, -- MsgSeparator
[1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
exec([[ exec([[
@ -29,7 +25,7 @@ describe(':global', function()
screen:expect([[ screen:expect([[
^foo | ^foo |
foo |*4 foo |*4
{1:Interrupted} | {9:Interrupted} |
]]) ]])
-- Also test in Ex mode -- Also test in Ex mode
@ -37,11 +33,11 @@ describe(':global', function()
poke_eventloop() -- Wait for :sleep to start poke_eventloop() -- Wait for :sleep to start
feed('<C-C>') feed('<C-C>')
screen:expect([[ screen:expect([[
{0: }| {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. | Entering Ex mode. Type "visual" to go to Normal mode. |
:g/foo/norm :; | :g/foo/norm :; |
| |
{1:Interrupted} | {9:Interrupted} |
:^ | :^ |
]]) ]])
end) end)

View File

@ -99,11 +99,6 @@ describe('Visual selection highlight', function()
-- oldtest: Test_visual_sbr() -- oldtest: Test_visual_sbr()
it("when 'showbreak' is set", function() it("when 'showbreak' is set", function()
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
exec([[ exec([[
set showbreak=> set showbreak=>
@ -112,9 +107,9 @@ describe('Visual selection highlight', function()
]]) ]])
feed('v$') feed('v$')
screen:expect([[ screen:expect([[
{0:>}{1:n, no sea takimata sanctus est Lorem ipsum dolor sit amet.}^ | {1:>}{17:n, no sea takimata sanctus est Lorem ipsum dolor sit amet.}^ |
|*4 |*4
{2:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
end) end)
end) end)

View File

@ -102,12 +102,6 @@ describe("'listchars'", function()
it('"exceeds" character does not appear in foldcolumn vim-patch:8.2.3121', function() it('"exceeds" character does not appear in foldcolumn vim-patch:8.2.3121', function()
local screen = Screen.new(60, 10) local screen = Screen.new(60, 10)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { bold = true, reverse = true }, -- StatusLine
[3] = { reverse = true }, -- StatusLineNC
[4] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- FoldColumn, SignColumn
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, ['aaa', '', 'a', 'aaaaaa']) call setline(1, ['aaa', '', 'a', 'aaaaaa'])
@ -117,83 +111,83 @@ describe("'listchars'", function()
]]) ]])
feed('13<C-W>>') feed('13<C-W>>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }a{1:>}{4: }^aaa | {7: }aaa {7: }a{1:>}{7: }^aaa |
{4: } {4: } {4: } | {7: } {7: } {7: } |
{4: }a {4: }a {4: }a | {7: }a {7: }a {7: }a |
{4: }aaaaaa {4: }a{1:>}{4: }aaaaaa | {7: }aaaaaa {7: }a{1:>}{7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] <[+] }{2:[No Name] [+] }| {2:[No Name] [+] <[+] }{3:[No Name] [+] }|
| |
]]) ]])
feed('<C-W>>') feed('<C-W>>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{1:>}{4: }^aaa | {7: }aaa {7: }{1:>}{7: }^aaa |
{4: } {4: } {4: } | {7: } {7: } {7: } |
{4: }a {4: }a{4: }a | {7: }a {7: }a{7: }a |
{4: }aaaaaa {4: }{1:>}{4: }aaaaaa | {7: }aaaaaa {7: }{1:>}{7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] <+] }{2:[No Name] [+] }| {2:[No Name] [+] <+] }{3:[No Name] [+] }|
| |
]]) ]])
feed('<C-W>>') feed('<C-W>>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{4: }^aaa | {7: }aaa {7: }{7: }^aaa |
{4: } {4: }{4: } | {7: } {7: }{7: } |
{4: }a {4: }{4: }a | {7: }a {7: }{7: }a |
{4: }aaaaaa {4: }{4: }aaaaaa | {7: }aaaaaa {7: }{7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] <] }{2:[No Name] [+] }| {2:[No Name] [+] <] }{3:[No Name] [+] }|
| |
]]) ]])
feed('<C-W>>') feed('<C-W>>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{4: }^aaa | {7: }aaa {7: }{7: }^aaa |
{4: } {4: }{4: } | {7: } {7: }{7: } |
{4: }a {4: }{4: }a | {7: }a {7: }{7: }a |
{4: }aaaaaa {4: }{4: }aaaaaa | {7: }aaaaaa {7: }{7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] < }{2:[No Name] [+] }| {2:[No Name] [+] < }{3:[No Name] [+] }|
| |
]]) ]])
feed('<C-W>>') feed('<C-W>>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{4: }^aaa | {7: }aaa {7: }{7: }^aaa |
{4: } {4: }{4: } | {7: } {7: }{7: } |
{4: }a {4: }{4: }a | {7: }a {7: }{7: }a |
{4: }aaaaaa {4: }{4: }aaaaaa | {7: }aaaaaa {7: }{7: }aaaaaa |
{1:~ }{1:~}{1:~ }|*4 {1:~ }{1:~}{1:~ }|*4
{3:[No Name] [+] < }{2:[No Name] [+] }| {2:[No Name] [+] < }{3:[No Name] [+] }|
| |
]]) ]])
feed('<C-W>h') feed('<C-W>h')
feed_command('set nowrap foldcolumn=4') feed_command('set nowrap foldcolumn=4')
screen:expect([[ screen:expect([[
{4: }aaa {4: }^aaa {4: }aaa | {7: }aaa {7: }^aaa {7: }aaa |
{4: } {4: } {4: } | {7: } {7: } {7: } |
{4: }a {4: }a {4: }a | {7: }a {7: }a {7: }a |
{4: }aaaaaa {4: }aaaaaa {4: }aaaaaa | {7: }aaaaaa {7: }aaaaaa {7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] }{2:[No Name] [+] }{3:[No Name] [+] }| {2:[No Name] [+] }{3:[No Name] [+] }{2:[No Name] [+] }|
:set nowrap foldcolumn=4 | :set nowrap foldcolumn=4 |
]]) ]])
feed('15<C-W><lt>') feed('15<C-W><lt>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{4: }aaa | {7: }aaa {7: }{7: }aaa |
{4: } {4: }{4: } | {7: } {7: }{7: } |
{4: }a {4: }{4: }a | {7: }a {7: }{7: }a |
{4: }aaaaaa {4: ^ }{4: }aaaaaa | {7: }aaaaaa {7: ^ }{7: }aaaaaa |
{1:~ }{1:~ }{1:~ }|*4 {1:~ }{1:~ }{1:~ }|*4
{3:[No Name] [+] }{2:<[+] }{3:[No Name] [+] }| {2:[No Name] [+] }{3:<[+] }{2:[No Name] [+] }|
:set nowrap foldcolumn=4 | :set nowrap foldcolumn=4 |
]]) ]])
feed('4<C-W><lt>') feed('4<C-W><lt>')
screen:expect([[ screen:expect([[
{4: }aaa {4: }{4: }aaa | {7: }aaa {7: }{7: }aaa |
{4: } {4: }{4: } | {7: } {7: }{7: } |
{4: }a {4: }{4: }a | {7: }a {7: }{7: }a |
{4: }aaaaaa {4:^ }{4: }aaaaaa | {7: }aaaaaa {7:^ }{7: }aaaaaa |
{1:~ }{1:~}{1:~ }|*4 {1:~ }{1:~}{1:~ }|*4
{3:[No Name] [+] }{2:< }{3:[No Name] [+] }| {2:[No Name] [+] }{3:< }{2:[No Name] [+] }|
:set nowrap foldcolumn=4 | :set nowrap foldcolumn=4 |
]]) ]])
end) end)

View File

@ -204,11 +204,6 @@ describe('listlbr', function()
-- oldtest: Test_linebreak_reset_restore() -- oldtest: Test_linebreak_reset_restore()
it('cursor position is drawn correctly after operator', function() it('cursor position is drawn correctly after operator', function()
local screen = Screen.new(60, 6) local screen = Screen.new(60, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
-- f_wincol() calls validate_cursor() -- f_wincol() calls validate_cursor()
@ -220,61 +215,61 @@ describe('listlbr', function()
feed('$v$') feed('$v$')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ | bbbbbbbbbb {17:c}^ |
{0:~ }|*3 {1:~ }|*3
2 | 2 |
]]) ]])
feed('zo') feed('zo')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c | bbbbbbbbbb ^c |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} | {9:E490: No fold found} |
]]) ]])
feed('$v$') feed('$v$')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ | bbbbbbbbbb {17:c}^ |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} 2 | {9:E490: No fold found} 2 |
]]) ]])
feed('gq') feed('gq')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c | bbbbbbbbbb ^c |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} | {9:E490: No fold found} |
]]) ]])
feed('$<C-V>$') feed('$<C-V>$')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ | bbbbbbbbbb {17:c}^ |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} 1x2 | {9:E490: No fold found} 1x2 |
]]) ]])
feed('I') feed('I')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^c | bbbbbbbbbb ^c |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} | {9:E490: No fold found} |
]]) ]])
feed('<Esc>$v$') feed('<Esc>$v$')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb {1:c}^ | bbbbbbbbbb {17:c}^ |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} 2 | {9:E490: No fold found} 2 |
]]) ]])
feed('s') feed('s')
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
bbbbbbbbbb ^ | bbbbbbbbbb ^ |
{0:~ }|*3 {1:~ }|*3
{2:E490: No fold found} | {9:E490: No fold found} |
]]) ]])
end) end)
end) end)

View File

@ -214,11 +214,6 @@ describe('linebreak', function()
-- oldtest: Test_visual_ends_before_showbreak() -- oldtest: Test_visual_ends_before_showbreak()
it("Visual area is correct when it ends before multibyte 'showbreak'", function() it("Visual area is correct when it ends before multibyte 'showbreak'", function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true }, -- ModeMsg
})
screen:attach() screen:attach()
exec([[ exec([[
let &wrap = v:true let &wrap = v:true
@ -229,10 +224,10 @@ describe('linebreak', function()
]]) ]])
screen:expect([[ screen:expect([[
xxxxx | xxxxx |
{0: }{1:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy}^ {1: }| {1: }{17:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy}^ {17: }|
{0: }zzzz | {1: }zzzz |
{0:~ }|*4 {1:~ }|*4
{2:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
end) end)
end) end)

View File

@ -10,28 +10,24 @@ describe('matchaddpos()', function()
-- oldtest: Test_matchaddpos_dump() -- oldtest: Test_matchaddpos_dump()
it('can add more than 8 match positions vim-patch:9.0.0620', function() it('can add more than 8 match positions vim-patch:9.0.0620', function()
local screen = Screen.new(60, 14) local screen = Screen.new(60, 14)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Yellow }, -- Search
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, ['1234567890123']->repeat(14)) call setline(1, ['1234567890123']->repeat(14))
call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]})) call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]}))
]]) ]])
screen:expect([[ screen:expect([[
{1:^1}234567890123 | {10:^1}234567890123 |
1{1:2}34567890123 | 1{10:2}34567890123 |
12{1:3}4567890123 | 12{10:3}4567890123 |
123{1:4}567890123 | 123{10:4}567890123 |
1234{1:5}67890123 | 1234{10:5}67890123 |
12345{1:6}7890123 | 12345{10:6}7890123 |
123456{1:7}890123 | 123456{10:7}890123 |
1234567{1:8}90123 | 1234567{10:8}90123 |
12345678{1:9}0123 | 12345678{10:9}0123 |
123456789{1:0}123 | 123456789{10:0}123 |
1234567890{1:1}23 | 1234567890{10:1}23 |
12345678901{1:2}3 | 12345678901{10:2}3 |
1234567890123 | 1234567890123 |
| |
]]) ]])
@ -42,10 +38,6 @@ describe('match highlighting', function()
-- oldtest: Test_match_in_linebreak() -- oldtest: Test_match_in_linebreak()
it('does not continue in linebreak vim-patch:8.2.3698', function() it('does not continue in linebreak vim-patch:8.2.3698', function()
local screen = Screen.new(75, 10) local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
exec([=[ exec([=[
set breakindent linebreak breakat+=] set breakindent linebreak breakat+=]
@ -53,20 +45,15 @@ describe('match highlighting', function()
call matchaddpos('ErrorMsg', [[1, 51]]) call matchaddpos('ErrorMsg', [[1, 51]])
]=]) ]=])
screen:expect([[ screen:expect([[
^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{1:]} | ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{9:]} |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
{0:~ }|*7 {1:~ }|*7
| |
]]) ]])
end) end)
it('is shown with incsearch vim-patch:8.2.3940', function() it('is shown with incsearch vim-patch:8.2.3940', function()
local screen = Screen.new(75, 6) local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Yellow }, -- Search
[2] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
exec([[ exec([[
set incsearch set incsearch
@ -76,16 +63,16 @@ describe('match highlighting', function()
screen:expect([[ screen:expect([[
^0 | ^0 |
1 | 1 |
{2:2} | {9:2} |
3 | 3 |
4 | 4 |
| |
]]) ]])
feed(':s/0') feed(':s/0')
screen:expect([[ screen:expect([[
{1:0} | {10:0} |
1 | 1 |
{2:2} | {9:2} |
3 | 3 |
4 | 4 |
:s/0^ | :s/0^ |
@ -94,10 +81,6 @@ describe('match highlighting', function()
it('on a Tab vim-patch:8.2.4062', function() it('on a Tab vim-patch:8.2.4062', function()
local screen = Screen.new(75, 10) local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
exec([[ exec([[
set linebreak set linebreak
@ -105,8 +88,8 @@ describe('match highlighting', function()
call matchadd('ErrorMsg', '\t') call matchadd('ErrorMsg', '\t')
]]) ]])
screen:expect([[ screen:expect([[
{1: ^ }ix | {9: ^ }ix |
{0:~ }|*8 {1:~ }|*8
| |
]]) ]])
end) end)

View File

@ -12,11 +12,6 @@ describe('matchparen', function()
it('redraws properly after scrolling with scrolloff=1', function() it('redraws properly after scrolling with scrolloff=1', function()
local screen = Screen.new(30, 7) local screen = Screen.new(30, 7)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true },
[2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
})
exec([[ exec([[
source $VIMRUNTIME/plugin/matchparen.vim source $VIMRUNTIME/plugin/matchparen.vim
set scrolloff=1 set scrolloff=1
@ -26,13 +21,13 @@ describe('matchparen', function()
feed('V<c-d><c-d>') feed('V<c-d><c-d>')
screen:expect([[ screen:expect([[
{2:{} | {17:{} |
{2:}} | {17:}} |
{2:{} | {17:{} |
{2:f} | {17:f} |
^g | ^g |
} | } |
{1:-- VISUAL LINE --} | {5:-- VISUAL LINE --} |
]]) ]])
end) end)
@ -116,13 +111,6 @@ describe('matchparen', function()
it('is cleared when completion popup is shown', function() it('is cleared when completion popup is shown', function()
local screen = Screen.new(30, 9) local screen = Screen.new(30, 9)
screen:attach() screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.Plum1 },
[2] = { background = Screen.colors.Grey },
[3] = { bold = true },
[4] = { bold = true, foreground = Screen.colors.SeaGreen },
})
exec([[ exec([[
source $VIMRUNTIME/plugin/matchparen.vim source $VIMRUNTIME/plugin/matchparen.vim
@ -138,11 +126,11 @@ describe('matchparen', function()
aaa | aaa |
aaaa | aaaa |
(aaa^) | (aaa^) |
{1: aa }{0: }| {4: aa }{1: }|
{2: aaa }{0: }| {12: aaa }{1: }|
{1: aaaa }{0: }| {4: aaaa }{1: }|
{0:~ }| {1:~ }|
{3:-- }{4:match 2 of 3} | {5:-- }{6:match 2 of 3} |
]], ]],
} }
end) end)

View File

@ -16,12 +16,6 @@ describe('messages', function()
-- oldtest: Test_warning_scroll() -- oldtest: Test_warning_scroll()
it('a warning causes scrolling if and only if it has a stacktrace', function() it('a warning causes scrolling if and only if it has a stacktrace', function()
screen = Screen.new(75, 6) screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { bold = true, reverse = true }, -- MsgSeparator
[3] = { foreground = Screen.colors.Red }, -- WarningMsg
})
screen:attach() screen:attach()
-- When the warning comes from a script, messages are scrolled so that the -- When the warning comes from a script, messages are scrolled so that the
@ -35,14 +29,14 @@ describe('messages', function()
screen:expect({ screen:expect({
grid = [[ grid = [[
| |
{0:~ }|*4 {1:~ }|*4
{3:W10: Warning: Changing a readonly file}^ | {19:W10: Warning: Changing a readonly file}^ |
]], ]],
timeout = 500, timeout = 500,
}) })
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*4 {1:~ }|*4
Already at oldest change | Already at oldest change |
]]) ]])
end) end)
@ -50,10 +44,6 @@ describe('messages', function()
-- oldtest: Test_message_not_cleared_after_mode() -- oldtest: Test_message_not_cleared_after_mode()
it('clearing mode does not remove message', function() it('clearing mode does not remove message', function()
screen = Screen.new(60, 10) screen = Screen.new(60, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
exec([[ exec([[
nmap <silent> gx :call DebugSilent('normal')<CR> nmap <silent> gx :call DebugSilent('normal')<CR>
@ -71,7 +61,7 @@ describe('messages', function()
^one | ^one |
NoSuchFile | NoSuchFile |
three | three |
{0:~ }|*6 {1:~ }|*6
from DebugSilent normal | from DebugSilent normal |
]]) ]])
@ -81,7 +71,7 @@ describe('messages', function()
^one | ^one |
NoSuchFile | NoSuchFile |
three | three |
{0:~ }|*6 {1:~ }|*6
from DebugSilent visual | from DebugSilent visual |
]]) ]])
@ -92,9 +82,9 @@ describe('messages', function()
one | one |
NoSuchFil^e | NoSuchFil^e |
three | three |
{0:~ }|*5 {1:~ }|*5
from DebugSilent visual | from DebugSilent visual |
{1:E447: Can't find file "NoSuchFile" in path} | {9:E447: Can't find file "NoSuchFile" in path} |
]]) ]])
end) end)
@ -403,10 +393,6 @@ describe('messages', function()
-- oldtest: Test_echo_verbose_system() -- oldtest: Test_echo_verbose_system()
it('verbose message before echo command', function() it('verbose message before echo command', function()
screen = Screen.new(60, 10) screen = Screen.new(60, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach() screen:attach()
command('cd ' .. nvim_dir) command('cd ' .. nvim_dir)
@ -426,7 +412,7 @@ describe('messages', function()
4: foo | 4: foo |
5: foo | 5: foo |
6: foo | 6: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<Space>') feed('<Space>')
screen:expect([[ screen:expect([[
@ -439,7 +425,7 @@ describe('messages', function()
13: foo | 13: foo |
14: foo | 14: foo |
15: foo | 15: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
@ -452,7 +438,7 @@ describe('messages', function()
4: foo | 4: foo |
5: foo | 5: foo |
6: foo | 6: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- do the same with 'cmdheight' set to 2 -- do the same with 'cmdheight' set to 2
@ -460,7 +446,7 @@ describe('messages', function()
command('set ch=2') command('set ch=2')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*7 {1:~ }|*7
|*2 |*2
]]) ]])
feed([[:4 verbose echo system('foo')<CR>]]) feed([[:4 verbose echo system('foo')<CR>]])
@ -474,7 +460,7 @@ describe('messages', function()
4: foo | 4: foo |
5: foo | 5: foo |
6: foo | 6: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<Space>') feed('<Space>')
screen:expect([[ screen:expect([[
@ -487,7 +473,7 @@ describe('messages', function()
13: foo | 13: foo |
14: foo | 14: foo |
15: foo | 15: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
@ -500,37 +486,32 @@ describe('messages', function()
4: foo | 4: foo |
5: foo | 5: foo |
6: foo | 6: foo |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
end) end)
-- oldtest: Test_quit_long_message() -- oldtest: Test_quit_long_message()
it('with control characters can be quit vim-patch:8.2.1844', function() it('with control characters can be quit vim-patch:8.2.1844', function()
screen = Screen.new(40, 10) screen = Screen.new(40, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { foreground = Screen.colors.Blue }, -- SpecialKey
})
screen:attach() screen:attach()
feed([[:echom range(9999)->join("\x01")<CR>]]) feed([[:echom range(9999)->join("\x01")<CR>]])
screen:expect([[ screen:expect([[
0{2:^A}1{2:^A}2{2:^A}3{2:^A}4{2:^A}5{2:^A}6{2:^A}7{2:^A}8{2:^A}9{2:^A}10{2:^A}11{2:^A}12| 0{18:^A}1{18:^A}2{18:^A}3{18:^A}4{18:^A}5{18:^A}6{18:^A}7{18:^A}8{18:^A}9{18:^A}10{18:^A}11{18:^A}12|
{2:^A}13{2:^A}14{2:^A}15{2:^A}16{2:^A}17{2:^A}18{2:^A}19{2:^A}20{2:^A}21{2:^A}22| {18:^A}13{18:^A}14{18:^A}15{18:^A}16{18:^A}17{18:^A}18{18:^A}19{18:^A}20{18:^A}21{18:^A}22|
{2:^A}23{2:^A}24{2:^A}25{2:^A}26{2:^A}27{2:^A}28{2:^A}29{2:^A}30{2:^A}31{2:^A}32| {18:^A}23{18:^A}24{18:^A}25{18:^A}26{18:^A}27{18:^A}28{18:^A}29{18:^A}30{18:^A}31{18:^A}32|
{2:^A}33{2:^A}34{2:^A}35{2:^A}36{2:^A}37{2:^A}38{2:^A}39{2:^A}40{2:^A}41{2:^A}42| {18:^A}33{18:^A}34{18:^A}35{18:^A}36{18:^A}37{18:^A}38{18:^A}39{18:^A}40{18:^A}41{18:^A}42|
{2:^A}43{2:^A}44{2:^A}45{2:^A}46{2:^A}47{2:^A}48{2:^A}49{2:^A}50{2:^A}51{2:^A}52| {18:^A}43{18:^A}44{18:^A}45{18:^A}46{18:^A}47{18:^A}48{18:^A}49{18:^A}50{18:^A}51{18:^A}52|
{2:^A}53{2:^A}54{2:^A}55{2:^A}56{2:^A}57{2:^A}58{2:^A}59{2:^A}60{2:^A}61{2:^A}62| {18:^A}53{18:^A}54{18:^A}55{18:^A}56{18:^A}57{18:^A}58{18:^A}59{18:^A}60{18:^A}61{18:^A}62|
{2:^A}63{2:^A}64{2:^A}65{2:^A}66{2:^A}67{2:^A}68{2:^A}69{2:^A}70{2:^A}71{2:^A}72| {18:^A}63{18:^A}64{18:^A}65{18:^A}66{18:^A}67{18:^A}68{18:^A}69{18:^A}70{18:^A}71{18:^A}72|
{2:^A}73{2:^A}74{2:^A}75{2:^A}76{2:^A}77{2:^A}78{2:^A}79{2:^A}80{2:^A}81{2:^A}82| {18:^A}73{18:^A}74{18:^A}75{18:^A}76{18:^A}77{18:^A}78{18:^A}79{18:^A}80{18:^A}81{18:^A}82|
{2:^A}83{2:^A}84{2:^A}85{2:^A}86{2:^A}87{2:^A}88{2:^A}89{2:^A}90{2:^A}91{2:^A}92| {18:^A}83{18:^A}84{18:^A}85{18:^A}86{18:^A}87{18:^A}88{18:^A}89{18:^A}90{18:^A}91{18:^A}92|
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('q') feed('q')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*8 {1:~ }|*8
| |
]]) ]])
end) end)
@ -539,11 +520,6 @@ describe('messages', function()
describe('mode is cleared when', function() describe('mode is cleared when', function()
before_each(function() before_each(function()
screen = Screen.new(40, 6) screen = Screen.new(40, 6)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { bold = true }, -- ModeMsg
[3] = { bold = true, reverse = true }, -- StatusLine
})
screen:attach() screen:attach()
end) end)
@ -561,7 +537,7 @@ describe('messages', function()
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{3: }| {3: }|
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<C-C>') feed('<C-C>')
screen:expect([[ screen:expect([[
@ -583,7 +559,7 @@ describe('messages', function()
^ | ^ |
{1:~ }|*3 {1:~ }|*3
{3:[No Name] }| {3:[No Name] }|
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<Esc>') feed('<Esc>')
screen:expect([[ screen:expect([[
@ -600,7 +576,7 @@ describe('messages', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }|*4 {1:~ }|*4
{2:-- (insert) --} | {5:-- (insert) --} |
]]) ]])
feed('<C-C>') feed('<C-C>')
screen:expect([[ screen:expect([[
@ -614,11 +590,6 @@ describe('messages', function()
-- oldtest: Test_ask_yesno() -- oldtest: Test_ask_yesno()
it('y/n prompt works', function() it('y/n prompt works', function()
screen = Screen.new(75, 6) screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
[2] = { bold = true, reverse = true }, -- MsgSeparator
})
screen:attach() screen:attach()
command('set noincsearch nohlsearch inccommand=') command('set noincsearch nohlsearch inccommand=')
command('call setline(1, range(1, 2))') command('call setline(1, range(1, 2))')
@ -627,57 +598,51 @@ describe('messages', function()
screen:expect([[ screen:expect([[
1 | 1 |
2 | 2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ | {6:Backwards range given, OK to swap (y/n)?}^ |
]]) ]])
feed('n') feed('n')
screen:expect([[ screen:expect([[
^1 | ^1 |
2 | 2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}n | {6:Backwards range given, OK to swap (y/n)?}n |
]]) ]])
feed(':2,1s/^/Esc/\n') feed(':2,1s/^/Esc/\n')
screen:expect([[ screen:expect([[
1 | 1 |
2 | 2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ | {6:Backwards range given, OK to swap (y/n)?}^ |
]]) ]])
feed('<Esc>') feed('<Esc>')
screen:expect([[ screen:expect([[
^1 | ^1 |
2 | 2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}n | {6:Backwards range given, OK to swap (y/n)?}n |
]]) ]])
feed(':2,1s/^/y/\n') feed(':2,1s/^/y/\n')
screen:expect([[ screen:expect([[
1 | 1 |
2 | 2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}^ | {6:Backwards range given, OK to swap (y/n)?}^ |
]]) ]])
feed('y') feed('y')
screen:expect([[ screen:expect([[
y1 | y1 |
^y2 | ^y2 |
{0:~ }|*3 {1:~ }|*3
{1:Backwards range given, OK to swap (y/n)?}y | {6:Backwards range given, OK to swap (y/n)?}y |
]]) ]])
end) end)
-- oldtest: Test_fileinfo_tabpage_cmdheight() -- oldtest: Test_fileinfo_tabpage_cmdheight()
it("fileinfo works when 'cmdheight' has just decreased", function() it("fileinfo works when 'cmdheight' has just decreased", function()
screen = Screen.new(40, 6) screen = Screen.new(40, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { bold = true }, -- TabLineSel
[2] = { underline = true, background = Screen.colors.LightGrey }, -- TabLine
[3] = { reverse = true }, -- TabLineFill
})
screen:attach() screen:attach()
exec([[ exec([[
@ -688,17 +653,17 @@ describe('messages', function()
set cmdheight=2 set cmdheight=2
]]) ]])
screen:expect([[ screen:expect([[
{2: [No Name] }{1: [No Name] }{3: }{2:X}| {24: [No Name] }{5: [No Name] }{2: }{24:X}|
^ | ^ |
{0:~ }|*2 {1:~ }|*2
|*2 |*2
]]) ]])
feed(':tabprev | edit Xfileinfo.txt<CR>') feed(':tabprev | edit Xfileinfo.txt<CR>')
screen:expect([[ screen:expect([[
{1: Xfileinfo.txt }{2: [No Name] }{3: }{2:X}| {5: Xfileinfo.txt }{24: [No Name] }{2: }{24:X}|
^ | ^ |
{0:~ }|*3 {1:~ }|*3
"Xfileinfo.txt" [New] | "Xfileinfo.txt" [New] |
]]) ]])
assert_alive() assert_alive()
@ -707,9 +672,6 @@ describe('messages', function()
-- oldtest: Test_fileinfo_after_echo() -- oldtest: Test_fileinfo_after_echo()
it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function() it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
screen = Screen.new(40, 6) screen = Screen.new(40, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
exec([[ exec([[
@ -730,7 +692,7 @@ describe('messages', function()
feed('0$') feed('0$')
screen:expect([[ screen:expect([[
^hi | ^hi |
{0:~ }|*4 {1:~ }|*4
'b' written | 'b' written |
]]) ]])
os.remove('b.txt') os.remove('b.txt')

View File

@ -10,9 +10,6 @@ describe(':move', function()
-- oldtest: Test_move_undo() -- oldtest: Test_move_undo()
it('redraws correctly when undone', function() it('redraws correctly when undone', function()
local screen = Screen.new(60, 10) local screen = Screen.new(60, 10)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach() screen:attach()
fn.setline(1, { 'First', 'Second', 'Third', 'Fourth' }) fn.setline(1, { 'First', 'Second', 'Third', 'Fourth' })
@ -22,7 +19,7 @@ describe(':move', function()
^First | ^First |
Third | Third |
Fourth | Fourth |
{0:~ }|*5 {1:~ }|*5
:move +1 | :move +1 |
]]) ]])
@ -34,7 +31,7 @@ describe(':move', function()
Second | Second |
Third | Third |
Fourth | Fourth |
{0:~ }|*5 {1:~ }|*5
| |
]]) ]])
end) end)

View File

@ -12,22 +12,21 @@ describe('normal', function()
function() function()
local screen = Screen.new(40, 19) local screen = Screen.new(40, 19)
screen:attach() screen:attach()
screen:set_default_attr_ids({ { foreground = Screen.colors.Brown } })
exec([[ exec([[
set number foldmethod=diff scrolloff=0 set number foldmethod=diff scrolloff=0
call setline(1, map(range(1, 9), 'repeat(v:val, 200)')) call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
norm Lj norm Lj
]]) ]])
screen:expect([[ screen:expect([[
{1: 2 }222222222222222222222222222222222222| {8: 2 }222222222222222222222222222222222222|
{1: }222222222222222222222222222222222222|*4 {8: }222222222222222222222222222222222222|*4
{1: }22222222222222222222 | {8: }22222222222222222222 |
{1: 3 }333333333333333333333333333333333333| {8: 3 }333333333333333333333333333333333333|
{1: }333333333333333333333333333333333333|*4 {8: }333333333333333333333333333333333333|*4
{1: }33333333333333333333 | {8: }33333333333333333333 |
{1: 4 }^444444444444444444444444444444444444| {8: 4 }^444444444444444444444444444444444444|
{1: }444444444444444444444444444444444444|*4 {8: }444444444444444444444444444444444444|*4
{1: }44444444444444444444 | {8: }44444444444444444444 |
| |
]]) ]])
end end

View File

@ -214,10 +214,6 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_callback() -- oldtest: Test_relativenumber_callback()
it('relative line numbers are updated if cursor is moved from timer', function() it('relative line numbers are updated if cursor is moved from timer', function()
local screen = Screen.new(50, 8) local screen = Screen.new(50, 8)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown }, -- LineNr
[2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd']) call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
@ -232,22 +228,22 @@ describe("'number' and 'relativenumber'", function()
]]) ]])
screen:expect({ screen:expect({
grid = [[ grid = [[
{1: 3 }aaaaa | {8: 3 }aaaaa |
{1: 2 }bbbbb | {8: 2 }bbbbb |
{1: 1 }ccccc | {8: 1 }ccccc |
{1: 0 }^ddddd | {8: 0 }^ddddd |
{2:~ }|*3 {1:~ }|*3
| |
]], ]],
timeout = 100, timeout = 100,
}) })
screen:expect({ screen:expect({
grid = [[ grid = [[
{1: 0 }^aaaaa | {8: 0 }^aaaaa |
{1: 1 }bbbbb | {8: 1 }bbbbb |
{1: 2 }ccccc | {8: 2 }ccccc |
{1: 3 }ddddd | {8: 3 }ddddd |
{2:~ }|*3 {1:~ }|*3
| |
]], ]],
}) })
@ -256,10 +252,6 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_number_insert_delete_lines() -- oldtest: Test_number_insert_delete_lines()
it('line numbers are updated when deleting/inserting lines', function() it('line numbers are updated when deleting/inserting lines', function()
local screen = Screen.new(50, 8) local screen = Screen.new(50, 8)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown }, -- LineNr
[2] = { bold = true, foreground = Screen.colors.Blue1 }, -- NonText
})
screen:attach() screen:attach()
exec([[ exec([[
call setline(1, range(1, 7)) call setline(1, range(1, 7))
@ -267,37 +259,37 @@ describe("'number' and 'relativenumber'", function()
call cursor(2, 1) call cursor(2, 1)
]]) ]])
local snapshot1 = [[ local snapshot1 = [[
{1: 1 }1 | {8: 1 }1 |
{1: 2 }^2 | {8: 2 }^2 |
{1: 3 }3 | {8: 3 }3 |
{1: 4 }4 | {8: 4 }4 |
{1: 5 }5 | {8: 5 }5 |
{1: 6 }6 | {8: 6 }6 |
{1: 7 }7 | {8: 7 }7 |
| |
]] ]]
screen:expect(snapshot1) screen:expect(snapshot1)
feed('dd') feed('dd')
screen:expect([[ screen:expect([[
{1: 1 }1 | {8: 1 }1 |
{1: 2 }^3 | {8: 2 }^3 |
{1: 3 }4 | {8: 3 }4 |
{1: 4 }5 | {8: 4 }5 |
{1: 5 }6 | {8: 5 }6 |
{1: 6 }7 | {8: 6 }7 |
{2:~ }| {1:~ }|
| |
]]) ]])
feed('P') feed('P')
screen:expect(snapshot1) screen:expect(snapshot1)
feed('2dd') feed('2dd')
screen:expect([[ screen:expect([[
{1: 1 }1 | {8: 1 }1 |
{1: 2 }^4 | {8: 2 }^4 |
{1: 3 }5 | {8: 3 }5 |
{1: 4 }6 | {8: 4 }6 |
{1: 5 }7 | {8: 5 }7 |
{2:~ }|*2 {1:~ }|*2
| |
]]) ]])
feed('P') feed('P')

View File

@ -659,10 +659,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_zero_width() -- oldtest: Test_smoothscroll_zero_width()
it('does not divide by zero with a narrow window', function() it('does not divide by zero with a narrow window', function()
screen:try_resize(12, 2) screen:try_resize(12, 2)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown },
[2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[ exec([[
call setline(1, ['a'->repeat(100)]) call setline(1, ['a'->repeat(100)])
set wrap smoothscroll number laststatus=0 set wrap smoothscroll number laststatus=0
@ -672,12 +668,12 @@ describe('smoothscroll', function()
wincmd v wincmd v
]]) ]])
screen:expect([[ screen:expect([[
{1: 1^ }{1: }{1: }{1: }{1: }| {8: 1^ }{8: }{8: }{8: }{8: }|
| |
]]) ]])
feed('llllllllll<C-W>o') feed('llllllllll<C-W>o')
screen:expect([[ screen:expect([[
{2:<<<}{1: }aa^aaaaaa| {1:<<<}{8: }aa^aaaaaa|
| |
]]) ]])
end) end)
@ -757,12 +753,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_incsearch() -- oldtest: Test_smoothscroll_incsearch()
it('does not reset skipcol when doing incremental search on the same word', function() it('does not reset skipcol when doing incremental search on the same word', function()
screen:try_resize(40, 8) screen:try_resize(40, 8)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown },
[2] = { foreground = Screen.colors.Blue1, bold = true },
[3] = { background = Screen.colors.Yellow1 },
[4] = { reverse = true },
})
exec([[ exec([[
set smoothscroll number scrolloff=0 incsearch set smoothscroll number scrolloff=0 incsearch
call setline(1, repeat([''], 20)) call setline(1, repeat([''], 20))
@ -771,46 +761,46 @@ describe('smoothscroll', function()
]]) ]])
feed('/b') feed('/b')
screen:expect([[ screen:expect([[
{2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{1: 12 } | {8: 12 } |
{1: 13 } | {8: 13 } |
{1: 14 }{4:b}{3:bbb} | {8: 14 }{2:b}{10:bbb} |
{1: 15 } | {8: 15 } |
{1: 16 } | {8: 16 } |
{1: 17 } | {8: 17 } |
/b^ | /b^ |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
{2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{1: 12 } | {8: 12 } |
{1: 13 } | {8: 13 } |
{1: 14 }{4:bb}{3:bb} | {8: 14 }{2:bb}{10:bb} |
{1: 15 } | {8: 15 } |
{1: 16 } | {8: 16 } |
{1: 17 } | {8: 17 } |
/bb^ | /bb^ |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
{2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{1: 12 } | {8: 12 } |
{1: 13 } | {8: 13 } |
{1: 14 }{4:bbb}b | {8: 14 }{2:bbb}b |
{1: 15 } | {8: 15 } |
{1: 16 } | {8: 16 } |
{1: 17 } | {8: 17 } |
/bbb^ | /bbb^ |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
{2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
{1: 12 } | {8: 12 } |
{1: 13 } | {8: 13 } |
{1: 14 }{4:bbbb} | {8: 14 }{2:bbbb} |
{1: 15 } | {8: 15 } |
{1: 16 } | {8: 16 } |
{1: 17 } | {8: 17 } |
/bbbb^ | /bbbb^ |
]]) ]])
end) end)
@ -818,10 +808,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_multi_skipcol() -- oldtest: Test_smoothscroll_multi_skipcol()
it('scrolling multiple lines and stopping at non-zero skipcol', function() it('scrolling multiple lines and stopping at non-zero skipcol', function()
screen:try_resize(40, 10) screen:try_resize(40, 10)
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.Blue, bold = true },
[1] = { background = Screen.colors.Grey90 },
})
exec([[ exec([[
setlocal cursorline scrolloff=0 smoothscroll setlocal cursorline scrolloff=0 smoothscroll
call setline(1, repeat([''], 8)) call setline(1, repeat([''], 8))
@ -832,7 +818,7 @@ describe('smoothscroll', function()
redraw redraw
]]) ]])
screen:expect([[ screen:expect([[
{1:^ }| {21:^ }|
| |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa | aaaaaaaaaa |
@ -844,22 +830,22 @@ describe('smoothscroll', function()
]]) ]])
feed('3<C-E>') feed('3<C-E>')
screen:expect([[ screen:expect([[
{0:<<<}{1:aaaaaa^a }| {1:<<<}{21:aaaaaa^a }|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa | aaaaaaaaaa |
|*2 |*2
bbb | bbb |
ccc | ccc |
{0:~ }|*2 {1:~ }|*2
| |
]]) ]])
feed('2<C-E>') feed('2<C-E>')
screen:expect([[ screen:expect([[
{0:<<<}{1:aaaaaa^a }| {1:<<<}{21:aaaaaa^a }|
|*2 |*2
bbb | bbb |
ccc | ccc |
{0:~ }|*4 {1:~ }|*4
| |
]]) ]])
end) end)
@ -867,12 +853,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot() -- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot()
it('does not divide by zero in zero-width window', function() it('does not divide by zero in zero-width window', function()
screen:try_resize(40, 19) screen:try_resize(40, 19)
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown }, -- LineNr
[2] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[3] = { bold = true, reverse = true }, -- StatusLine
[4] = { reverse = true }, -- StatusLineNC
})
exec([[ exec([[
silent normal yy silent normal yy
silent normal 19p silent normal 19p
@ -885,10 +865,10 @@ describe('smoothscroll', function()
silent normal 20G silent normal 20G
]]) ]])
screen:expect([[ screen:expect([[
{1: } | {8: } |
{2:@} |*15 {1:@} |*15
{2:^@} | {1:^@} |
{3:< }{4:[No Name] [+] }| {3:< }{2:[No Name] [+] }|
| |
]]) ]])
end) end)
@ -1085,41 +1065,37 @@ describe('smoothscroll', function()
end) end)
it('works with very long line', function() it('works with very long line', function()
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Brown },
[2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[ exec([[
edit test/functional/fixtures/bigfile_oneline.txt edit test/functional/fixtures/bigfile_oneline.txt
setlocal smoothscroll number setlocal smoothscroll number
]]) ]])
screen:expect([[ screen:expect([[
{1: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;| {8: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;|
{1: }; 0001;<control>;Cc;0;BN;;;;;N;START| {8: }; 0001;<control>;Cc;0;BN;;;;;N;START|
{1: } OF HEADING;;;; 0002;<control>;Cc;0;| {8: } OF HEADING;;;; 0002;<control>;Cc;0;|
{1: }BN;;;;;N;START OF TEXT;;;; 0003;<con| {8: }BN;;;;;N;START OF TEXT;;;; 0003;<con|
{1: }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; | {8: }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
{1: }0004;<control>;Cc;0;BN;;;;;N;END OF | {8: }0004;<control>;Cc;0;BN;;;;;N;END OF |
{1: }TRANSMISSION;;;; 0005;<control>;Cc;0| {8: }TRANSMISSION;;;; 0005;<control>;Cc;0|
{1: };BN;;;;;N;ENQUIRY;;;; 0006;<control>| {8: };BN;;;;;N;ENQUIRY;;;; 0006;<control>|
{1: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;| {8: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;|
{1: }<control>;Cc;0;BN;;;;;N;BELL;;;; 000| {8: }<control>;Cc;0;BN;;;;;N;BELL;;;; 000|
{1: }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;| {8: }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;|
| |
]]) ]])
feed('j') feed('j')
screen:expect([[ screen:expect([[
{2:<<<}{1: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo| {1:<<<}{8: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo|
{1: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA| {8: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA|
{1: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228| {8: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228|
{1: };;;;N;;;;; 2F921;CJK COMPATIBILITY I| {8: };;;;N;;;;; 2F921;CJK COMPATIBILITY I|
{1: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;| {8: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;|
{1: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2| {8: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2|
{1: }F922;Lo;0;L;7250;;;;N;;;;; | {8: }F922;Lo;0;L;7250;;;;N;;;;; |
{1: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F| {8: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F|
{1: }923;Lo;0;L;24608;;;;N;;;;; | {8: }923;Lo;0;L;24608;;;;N;;;;; |
{1: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F| {8: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F|
{1: }924;Lo;0;L;7280;;;;N;;;;; | {8: }924;Lo;0;L;7280;;;;N;;;;; |
| |
]]) ]])
end) end)

View File

@ -745,11 +745,6 @@ describe('Search highlight', function()
-- oldtest: Test_hlsearch_dump() -- oldtest: Test_hlsearch_dump()
it('beyond line end vim-patch:8.2.2542', function() it('beyond line end vim-patch:8.2.2542', function()
local screen = Screen.new(50, 6) local screen = Screen.new(50, 6)
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { background = Screen.colors.Yellow }, -- Search
[3] = { background = Screen.colors.Grey90 }, -- CursorLine
})
screen:attach() screen:attach()
exec([[ exec([[
set hlsearch noincsearch cursorline set hlsearch noincsearch cursorline
@ -759,8 +754,8 @@ describe('Search highlight', function()
]]) ]])
feed([[/\_.*<CR>]]) feed([[/\_.*<CR>]])
screen:expect([[ screen:expect([[
{2:xxx } |*2 {10:xxx } |*2
{2:^xxx }{3: }| {10:^xxx }{21: }|
{1:~ }|*2 {1:~ }|*2
/\_.* | /\_.* |
]]) ]])

View File

@ -16,16 +16,12 @@ describe(':source!', function()
]] ]]
) )
local screen = Screen.new(75, 6) local screen = Screen.new(75, 6)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- ErrorMsg
})
screen:attach() screen:attach()
feed(':source! Xscript.vim\n') feed(':source! Xscript.vim\n')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*4 {1:~ }|*4
{1:E22: Scripts nested too deep} | {9:E22: Scripts nested too deep} |
]]) ]])
os.remove('Xscript.vim') os.remove('Xscript.vim')
end) end)

View File

@ -15,11 +15,6 @@ describe('statusline', function()
end) end)
it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function() it('is updated in cmdline mode when using window-local statusline vim-patch:8.2.2737', function()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { bold = true, reverse = true }, -- StatusLine
[3] = { reverse = true }, -- StatusLineNC
})
exec([[ exec([[
setlocal statusline=-%{mode()}- setlocal statusline=-%{mode()}-
split split
@ -28,30 +23,25 @@ describe('statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }| {1:~ }|
{2:+n+ }| {3:+n+ }|
| |
{1:~ }| {1:~ }|
{3:-n- }| {2:-n- }|
| |
]]) ]])
feed(':') feed(':')
screen:expect([[ screen:expect([[
| |
{1:~ }| {1:~ }|
{2:+c+ }| {3:+c+ }|
| |
{1:~ }| {1:~ }|
{3:-c- }| {2:-c- }|
:^ | :^ |
]]) ]])
end) end)
it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function() it('truncated item does not cause off-by-one highlight vim-patch:8.2.4929', function()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[2] = { foreground = Screen.colors.Blue }, -- User1
[3] = { background = Screen.colors.Red, foreground = Screen.colors.White }, -- User2
})
exec([[ exec([[
set laststatus=2 set laststatus=2
hi! link User1 Directory hi! link User1 Directory
@ -61,20 +51,13 @@ describe('statusline', function()
screen:expect([[ screen:expect([[
^ | ^ |
{1:~ }|*4 {1:~ }|*4
{3:<F}{2:GHI }| {9:<F}{18:GHI }|
| |
]]) ]])
end) end)
-- oldtest: Test_statusline_showcmd() -- oldtest: Test_statusline_showcmd()
it('showcmdloc=statusline works', function() it('showcmdloc=statusline works', function()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true }, -- MoreMsg
[3] = { bold = true, reverse = true }, -- StatusLine
[5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded
})
exec([[ exec([[
func MyStatusLine() func MyStatusLine()
return '%S' return '%S'
@ -92,9 +75,9 @@ describe('statusline', function()
feed('g') feed('g')
screen:expect([[ screen:expect([[
{5:+-- 2 lines: a···································}| {13:+-- 2 lines: a···································}|
^c | ^c |
{0:~ }|*3 {1:~ }|*3
{3:g }| {3:g }|
| |
]]) ]])
@ -105,19 +88,19 @@ describe('statusline', function()
^a | ^a |
b | b |
c | c |
{0:~ }|*2 {1:~ }|*2
{3: }| {3: }|
| |
]]) ]])
feed('<C-V>Gl') feed('<C-V>Gl')
screen:expect([[ screen:expect([[
{1:a} | {17:a} |
{1:b} | {17:b} |
{1:c}^ | {17:c}^ |
{0:~ }|*2 {1:~ }|*2
{3:3x2 }| {3:3x2 }|
{2:-- VISUAL BLOCK --} | {5:-- VISUAL BLOCK --} |
]]) ]])
feed('<Esc>1234') feed('<Esc>1234')
@ -125,7 +108,7 @@ describe('statusline', function()
a | a |
b | b |
^c | ^c |
{0:~ }|*2 {1:~ }|*2
{3:1234 }| {3:1234 }|
| |
]]) ]])
@ -137,7 +120,7 @@ describe('statusline', function()
a | a |
b | b |
^c | ^c |
{0:~ }|*2 {1:~ }|*2
{3:[No Name] [+] 1234 }| {3:[No Name] [+] 1234 }|
: | : |
]]) ]])

View File

@ -209,11 +209,6 @@ describe(':substitute', function()
it('first char is highlighted with confirmation dialog and empty match', function() it('first char is highlighted with confirmation dialog and empty match', function()
local screen = Screen.new(60, 8) local screen = Screen.new(60, 8)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { reverse = true }, -- IncSearch
[2] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
})
screen:attach() screen:attach()
exec([[ exec([[
set nohlsearch noincsearch set nohlsearch noincsearch
@ -221,11 +216,11 @@ describe(':substitute', function()
]]) ]])
feed(':%s/^/ /c<CR>') feed(':%s/^/ /c<CR>')
screen:expect([[ screen:expect([[
{1:o}ne | {2:o}ne |
two | two |
three | three |
{0:~ }|*4 {1:~ }|*4
{2:replace with (y/n/a/q/l/^E/^Y)?}^ | {6:replace with (y/n/a/q/l/^E/^Y)?}^ |
]]) ]])
end) end)
end) end)

View File

@ -16,14 +16,6 @@ describe('tabline', function()
-- oldtest: Test_tabline_showcmd() -- oldtest: Test_tabline_showcmd()
it('showcmdloc=tabline works', function() it('showcmdloc=tabline works', function()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
[1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
[2] = { bold = true }, -- MoreMsg, TabLineSel
[3] = { reverse = true }, -- TabLineFill
[4] = { background = Screen.colors.LightGrey, underline = true }, -- TabLine
[5] = { background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue }, -- Folded
})
exec([[ exec([[
func MyTabLine() func MyTabLine()
return '%S' return '%S'
@ -41,41 +33,41 @@ describe('tabline', function()
feed('g') feed('g')
screen:expect([[ screen:expect([[
{3:g }| {2:g }|
{5:+-- 2 lines: a···································}| {13:+-- 2 lines: a···································}|
^c | ^c |
{0:~ }|*3 {1:~ }|*3
| |
]]) ]])
-- typing "gg" should open the fold -- typing "gg" should open the fold
feed('g') feed('g')
screen:expect([[ screen:expect([[
{3: }| {2: }|
^a | ^a |
b | b |
c | c |
{0:~ }|*2 {1:~ }|*2
| |
]]) ]])
feed('<C-V>Gl') feed('<C-V>Gl')
screen:expect([[ screen:expect([[
{3:3x2 }| {2:3x2 }|
{1:a} | {17:a} |
{1:b} | {17:b} |
{1:c}^ | {17:c}^ |
{0:~ }|*2 {1:~ }|*2
{2:-- VISUAL BLOCK --} | {5:-- VISUAL BLOCK --} |
]]) ]])
feed('<Esc>1234') feed('<Esc>1234')
screen:expect([[ screen:expect([[
{3:1234 }| {2:1234 }|
a | a |
b | b |
^c | ^c |
{0:~ }|*2 {1:~ }|*2
| |
]]) ]])
@ -83,11 +75,11 @@ describe('tabline', function()
feed(':<CR>') feed(':<CR>')
feed('1234') feed('1234')
screen:expect([[ screen:expect([[
{2: + [No Name] }{3: }{4:1234}{3: }| {5: + [No Name] }{2: }{24:1234}{2: }|
a | a |
b | b |
^c | ^c |
{0:~ }|*2 {1:~ }|*2
: | : |
]]) ]])
end) end)

View File

@ -12,11 +12,6 @@ describe('Visual highlight', function()
before_each(function() before_each(function()
screen = Screen.new(50, 6) screen = Screen.new(50, 6)
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.Blue, bold = true }, -- NonText
[1] = { bold = true }, -- ModeMsg
[2] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
})
screen:attach() screen:attach()
end) end)
@ -30,20 +25,20 @@ describe('Visual highlight', function()
feed('<C-V>gg$') feed('<C-V>gg$')
screen:expect([[ screen:expect([[
{2:aaaaaa}^ | {17:aaaaaa}^ |
{2:bbbb } | {17:bbbb } |
{2:cc } | {17:cc } |
{0:~ }|*2 {1:~ }|*2
{1:-- VISUAL BLOCK --} | {5:-- VISUAL BLOCK --} |
]]) ]])
feed('<Esc>gg<C-V>G$') feed('<Esc>gg<C-V>G$')
screen:expect([[ screen:expect([[
{2:aaaaaa } | {17:aaaaaa } |
{2:bbbb } | {17:bbbb } |
{2:cc}^ {2: } | {17:cc}^ {17: } |
{0:~ }|*2 {1:~ }|*2
{1:-- VISUAL BLOCK --} | {5:-- VISUAL BLOCK --} |
]]) ]])
end) end)
@ -57,9 +52,9 @@ describe('Visual highlight', function()
screen:expect([[ screen:expect([[
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a|
{0:+}{2:aaaa}aaaaaa | {1:+}{17:aaaa}aaaaaa |
{0:~ }|*3 {1:~ }|*3
{1:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
end) end)
end) end)

View File

@ -10,9 +10,6 @@ local feed = helpers.feed
it('scrolling with laststatus=0 and :botright split', function() it('scrolling with laststatus=0 and :botright split', function()
clear('--cmd', 'set ruler') clear('--cmd', 'set ruler')
local screen = Screen.new(40, 10) local screen = Screen.new(40, 10)
screen:set_default_attr_ids({
[1] = { reverse = true }, -- StatusLineNC
})
screen:attach() screen:attach()
exec([[ exec([[
set laststatus=0 set laststatus=0
@ -25,7 +22,7 @@ it('scrolling with laststatus=0 and :botright split', function()
98 | 98 |
99 | 99 |
100 | 100 |
{1:[No Name] [+] 100,1 Bot}| {2:[No Name] [+] 100,1 Bot}|
97 | 97 |
98 | 98 |
99 | 99 |