mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
refactor(tests): use new-style highlight spec in legacy/
This commit is contained in:
@@ -12,11 +12,6 @@ describe('breakindent', function()
|
||||
-- oldtest: Test_cursor_position_with_showbreak()
|
||||
it('cursor shown at correct position with showbreak', function()
|
||||
local screen = Screen.new(75, 6)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[1] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
|
||||
[2] = { bold = true }, -- ModeMsg
|
||||
})
|
||||
exec([[
|
||||
set listchars=eol:$
|
||||
let &signcolumn = 'yes'
|
||||
@@ -29,10 +24,10 @@ describe('breakindent', function()
|
||||
|
||||
feed('AX')
|
||||
screen:expect([[
|
||||
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{1: }^second line |
|
||||
{0:~ }|*3
|
||||
{2:-- INSERT --} |
|
||||
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{7: }^second line |
|
||||
{1:~ }|*3
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
-- No line wraps, so changing 'showbreak' should lead to the same screen.
|
||||
command('setlocal showbreak=+')
|
||||
@@ -43,19 +38,19 @@ describe('breakindent', function()
|
||||
-- The first line now wraps because of "eol" in 'listchars'.
|
||||
command('setlocal list')
|
||||
screen:expect([[
|
||||
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{1: } {0:+^$} |
|
||||
{1: }second line{0:$} |
|
||||
{0:~ }|*2
|
||||
{2:-- INSERT --} |
|
||||
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{7: } {1:+^$} |
|
||||
{7: }second line{1:$} |
|
||||
{1:~ }|*2
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
command('setlocal nobreakindent')
|
||||
screen:expect([[
|
||||
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{1: }{0:+^$} |
|
||||
{1: }second line{0:$} |
|
||||
{0:~ }|*2
|
||||
{2:-- INSERT --} |
|
||||
{7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
|
||||
{7: }{1:+^$} |
|
||||
{7: }second line{1:$} |
|
||||
{1:~ }|*2
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
|
@@ -294,41 +294,34 @@ describe('cmdwin', function()
|
||||
-- oldtest: Test_cmdwin_interrupted()
|
||||
it('still uses a new buffer when interrupting more prompt on open', function()
|
||||
local screen = Screen.new(30, 16)
|
||||
screen:set_default_attr_ids({
|
||||
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[1] = { bold = true, reverse = true }, -- StatusLine
|
||||
[2] = { reverse = true }, -- StatusLineNC
|
||||
[3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
|
||||
[4] = { bold = true }, -- ModeMsg
|
||||
})
|
||||
command('set more')
|
||||
command('autocmd WinNew * highlight')
|
||||
feed('q:')
|
||||
screen:expect({ any = pesc('{3:-- More --}^') })
|
||||
screen:expect({ any = pesc('{6:-- More --}^') })
|
||||
feed('q')
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|*5
|
||||
{1:~ }|*5
|
||||
{2:[No Name] }|
|
||||
{0::}^ |
|
||||
{0:~ }|*6
|
||||
{1:[Command Line] }|
|
||||
{1::}^ |
|
||||
{1:~ }|*6
|
||||
{3:[Command Line] }|
|
||||
|
|
||||
]])
|
||||
feed([[aecho 'done']])
|
||||
screen:expect([[
|
||||
|
|
||||
{0:~ }|*5
|
||||
{1:~ }|*5
|
||||
{2:[No Name] }|
|
||||
{0::}echo 'done'^ |
|
||||
{0:~ }|*6
|
||||
{1:[Command Line] }|
|
||||
{4:-- INSERT --} |
|
||||
{1::}echo 'done'^ |
|
||||
{1:~ }|*6
|
||||
{3:[Command Line] }|
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|*14
|
||||
{1:~ }|*14
|
||||
done |
|
||||
]])
|
||||
end)
|
||||
|
@@ -45,11 +45,6 @@ describe('display', function()
|
||||
|
||||
local function run_test_display_lastline(euro)
|
||||
local screen = Screen.new(75, 10)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[2] = { bold = true, reverse = true }, -- StatusLine
|
||||
[3] = { reverse = true }, -- StatusLineNC
|
||||
})
|
||||
exec([[
|
||||
call setline(1, ['aaa', 'b'->repeat(200)])
|
||||
set display=truncate
|
||||
@@ -68,7 +63,7 @@ describe('display', function()
|
||||
b│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
||||
b│{1:~ }|*3
|
||||
{1:@}│{1:~ }|
|
||||
{2:< }{3:[No Name] [+] }|
|
||||
{3:< }{2:[No Name] [+] }|
|
||||
|
|
||||
]]):gsub('@', fillchar)))
|
||||
|
||||
@@ -82,7 +77,7 @@ describe('display', function()
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │b|
|
||||
{1:~ }│b|*3
|
||||
{1:~ }│{1:@}|
|
||||
{2:[No Name] [+] }{3:<}|
|
||||
{3:[No Name] [+] }{2:<}|
|
||||
|
|
||||
]]):gsub('@', fillchar)))
|
||||
|
||||
@@ -95,11 +90,11 @@ describe('display', function()
|
||||
^aaa |
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
|
||||
{1:@@@ }|
|
||||
{2:[No Name] [+] }|
|
||||
{3:[No Name] [+] }|
|
||||
aaa |
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*2
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
||||
{3:[No Name] [+] }|
|
||||
{2:[No Name] [+] }|
|
||||
|
|
||||
]]):gsub('@', fillchar)))
|
||||
|
||||
@@ -112,7 +107,7 @@ describe('display', function()
|
||||
bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
||||
bb│{1:~ }|*3
|
||||
{1:@@}│{1:~ }|
|
||||
{2:< }{3:[No Name] [+] }|
|
||||
{3:< }{2:[No Name] [+] }|
|
||||
|
|
||||
]]):gsub('@', fillchar)))
|
||||
end
|
||||
|
@@ -122,10 +122,6 @@ describe('messages', function()
|
||||
-- oldtest: Test_message_more()
|
||||
it('works', function()
|
||||
screen = Screen.new(75, 6)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
|
||||
[2] = { foreground = Screen.colors.Brown }, -- LineNr
|
||||
})
|
||||
|
||||
command('call setline(1, range(1, 100))')
|
||||
|
||||
@@ -140,194 +136,194 @@ describe('messages', function()
|
||||
]])
|
||||
feed('\n')
|
||||
screen:expect([[
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{1:-- More --}^ |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
feed('?')
|
||||
screen:expect([[
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{1:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{6:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ |
|
||||
]])
|
||||
|
||||
-- Down a line with j, <CR>, <NL> or <Down>.
|
||||
feed('j')
|
||||
screen:expect([[
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{2: 6 }6 |
|
||||
{1:-- More --}^ |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{8: 6 }6 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<NL>')
|
||||
screen:expect([[
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{2: 6 }6 |
|
||||
{2: 7 }7 |
|
||||
{1:-- More --}^ |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{8: 6 }6 |
|
||||
{8: 7 }7 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{2: 6 }6 |
|
||||
{2: 7 }7 |
|
||||
{2: 8 }8 |
|
||||
{1:-- More --}^ |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{8: 6 }6 |
|
||||
{8: 7 }7 |
|
||||
{8: 8 }8 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<Down>')
|
||||
screen:expect([[
|
||||
{2: 5 }5 |
|
||||
{2: 6 }6 |
|
||||
{2: 7 }7 |
|
||||
{2: 8 }8 |
|
||||
{2: 9 }9 |
|
||||
{1:-- More --}^ |
|
||||
{8: 5 }5 |
|
||||
{8: 6 }6 |
|
||||
{8: 7 }7 |
|
||||
{8: 8 }8 |
|
||||
{8: 9 }9 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Down a screen with <Space>, f, or <PageDown>.
|
||||
feed('f')
|
||||
screen:expect([[
|
||||
{2: 10 }10 |
|
||||
{2: 11 }11 |
|
||||
{2: 12 }12 |
|
||||
{2: 13 }13 |
|
||||
{2: 14 }14 |
|
||||
{1:-- More --}^ |
|
||||
{8: 10 }10 |
|
||||
{8: 11 }11 |
|
||||
{8: 12 }12 |
|
||||
{8: 13 }13 |
|
||||
{8: 14 }14 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<Space>')
|
||||
screen:expect([[
|
||||
{2: 15 }15 |
|
||||
{2: 16 }16 |
|
||||
{2: 17 }17 |
|
||||
{2: 18 }18 |
|
||||
{2: 19 }19 |
|
||||
{1:-- More --}^ |
|
||||
{8: 15 }15 |
|
||||
{8: 16 }16 |
|
||||
{8: 17 }17 |
|
||||
{8: 18 }18 |
|
||||
{8: 19 }19 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<PageDown>')
|
||||
screen:expect([[
|
||||
{2: 20 }20 |
|
||||
{2: 21 }21 |
|
||||
{2: 22 }22 |
|
||||
{2: 23 }23 |
|
||||
{2: 24 }24 |
|
||||
{1:-- More --}^ |
|
||||
{8: 20 }20 |
|
||||
{8: 21 }21 |
|
||||
{8: 22 }22 |
|
||||
{8: 23 }23 |
|
||||
{8: 24 }24 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Down a page (half a screen) with d.
|
||||
feed('d')
|
||||
screen:expect([[
|
||||
{2: 23 }23 |
|
||||
{2: 24 }24 |
|
||||
{2: 25 }25 |
|
||||
{2: 26 }26 |
|
||||
{2: 27 }27 |
|
||||
{1:-- More --}^ |
|
||||
{8: 23 }23 |
|
||||
{8: 24 }24 |
|
||||
{8: 25 }25 |
|
||||
{8: 26 }26 |
|
||||
{8: 27 }27 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Down all the way with 'G'.
|
||||
feed('G')
|
||||
screen:expect([[
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{2: 99 }99 |
|
||||
{2:100 }100 |
|
||||
{1:Press ENTER or type command to continue}^ |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{8: 99 }99 |
|
||||
{8:100 }100 |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
|
||||
-- Up a line k, <BS> or <Up>.
|
||||
feed('k')
|
||||
screen:expect([[
|
||||
{2: 95 }95 |
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{2: 99 }99 |
|
||||
{1:-- More --}^ |
|
||||
{8: 95 }95 |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{8: 99 }99 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
{2: 94 }94 |
|
||||
{2: 95 }95 |
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{1:-- More --}^ |
|
||||
{8: 94 }94 |
|
||||
{8: 95 }95 |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<Up>')
|
||||
screen:expect([[
|
||||
{2: 93 }93 |
|
||||
{2: 94 }94 |
|
||||
{2: 95 }95 |
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{1:-- More --}^ |
|
||||
{8: 93 }93 |
|
||||
{8: 94 }94 |
|
||||
{8: 95 }95 |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Up a screen with b or <PageUp>.
|
||||
feed('b')
|
||||
screen:expect([[
|
||||
{2: 88 }88 |
|
||||
{2: 89 }89 |
|
||||
{2: 90 }90 |
|
||||
{2: 91 }91 |
|
||||
{2: 92 }92 |
|
||||
{1:-- More --}^ |
|
||||
{8: 88 }88 |
|
||||
{8: 89 }89 |
|
||||
{8: 90 }90 |
|
||||
{8: 91 }91 |
|
||||
{8: 92 }92 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed('<PageUp>')
|
||||
screen:expect([[
|
||||
{2: 83 }83 |
|
||||
{2: 84 }84 |
|
||||
{2: 85 }85 |
|
||||
{2: 86 }86 |
|
||||
{2: 87 }87 |
|
||||
{1:-- More --}^ |
|
||||
{8: 83 }83 |
|
||||
{8: 84 }84 |
|
||||
{8: 85 }85 |
|
||||
{8: 86 }86 |
|
||||
{8: 87 }87 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Up a page (half a screen) with u.
|
||||
feed('u')
|
||||
screen:expect([[
|
||||
{2: 80 }80 |
|
||||
{2: 81 }81 |
|
||||
{2: 82 }82 |
|
||||
{2: 83 }83 |
|
||||
{2: 84 }84 |
|
||||
{1:-- More --}^ |
|
||||
{8: 80 }80 |
|
||||
{8: 81 }81 |
|
||||
{8: 82 }82 |
|
||||
{8: 83 }83 |
|
||||
{8: 84 }84 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Up all the way with 'g'.
|
||||
feed('g')
|
||||
screen:expect([[
|
||||
:%p# |
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{1:-- More --}^ |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- All the way down. Pressing f should do nothing but pressing
|
||||
-- space should end the more prompt.
|
||||
feed('G')
|
||||
screen:expect([[
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{2: 99 }99 |
|
||||
{2:100 }100 |
|
||||
{1:Press ENTER or type command to continue}^ |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{8: 99 }99 |
|
||||
{8:100 }100 |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed('f')
|
||||
screen:expect_unchanged()
|
||||
@@ -344,34 +340,34 @@ describe('messages', function()
|
||||
-- Pressing g< shows the previous command output.
|
||||
feed('g<lt>')
|
||||
screen:expect([[
|
||||
{2: 96 }96 |
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{2: 99 }99 |
|
||||
{2:100 }100 |
|
||||
{1:Press ENTER or type command to continue}^ |
|
||||
{8: 96 }96 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{8: 99 }99 |
|
||||
{8:100 }100 |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
|
||||
-- A command line that doesn't print text is appended to scrollback,
|
||||
-- even if it invokes a nested command line.
|
||||
feed([[:<C-R>=':'<CR>:<CR>g<lt>]])
|
||||
screen:expect([[
|
||||
{2: 97 }97 |
|
||||
{2: 98 }98 |
|
||||
{2: 99 }99 |
|
||||
{2:100 }100 |
|
||||
{8: 97 }97 |
|
||||
{8: 98 }98 |
|
||||
{8: 99 }99 |
|
||||
{8:100 }100 |
|
||||
::: |
|
||||
{1:Press ENTER or type command to continue}^ |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
|
||||
feed(':%p#\n')
|
||||
screen:expect([[
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{1:-- More --}^ |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
|
||||
-- Stop command output with q, <Esc> or CTRL-C.
|
||||
@@ -388,30 +384,30 @@ describe('messages', function()
|
||||
-- Execute a : command from the more prompt
|
||||
feed(':%p#\n')
|
||||
screen:expect([[
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{1:-- More --}^ |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
{6:-- More --}^ |
|
||||
]])
|
||||
feed(':')
|
||||
screen:expect([[
|
||||
{2: 1 }1 |
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{8: 1 }1 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
:^ |
|
||||
]])
|
||||
feed("echo 'Hello'\n")
|
||||
screen:expect([[
|
||||
{2: 2 }2 |
|
||||
{2: 3 }3 |
|
||||
{2: 4 }4 |
|
||||
{2: 5 }5 |
|
||||
{8: 2 }2 |
|
||||
{8: 3 }3 |
|
||||
{8: 4 }4 |
|
||||
{8: 5 }5 |
|
||||
Hello |
|
||||
{1:Press ENTER or type command to continue}^ |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
|
@@ -12,11 +12,9 @@ describe("'number' and 'relativenumber'", function()
|
||||
-- oldtest: Test_relativenumber_colors()
|
||||
it('LineNr, LineNrAbove and LineNrBelow', function()
|
||||
local screen = Screen.new(50, 10)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { foreground = Screen.colors.Red },
|
||||
[2] = { foreground = Screen.colors.Blue },
|
||||
[3] = { foreground = Screen.colors.Green },
|
||||
})
|
||||
screen:add_extra_attr_ids {
|
||||
[100] = { foreground = Screen.colors.WebGreen },
|
||||
}
|
||||
exec([[
|
||||
call setline(1, range(200))
|
||||
111
|
||||
@@ -24,54 +22,54 @@ describe("'number' and 'relativenumber'", function()
|
||||
hi LineNr guifg=red
|
||||
]])
|
||||
screen:expect([[
|
||||
{1: 4 }106 |
|
||||
{1: 3 }107 |
|
||||
{1: 2 }108 |
|
||||
{1: 1 }109 |
|
||||
{1:111 }^110 |
|
||||
{1: 1 }111 |
|
||||
{1: 2 }112 |
|
||||
{1: 3 }113 |
|
||||
{1: 4 }114 |
|
||||
{19: 4 }106 |
|
||||
{19: 3 }107 |
|
||||
{19: 2 }108 |
|
||||
{19: 1 }109 |
|
||||
{19:111 }^110 |
|
||||
{19: 1 }111 |
|
||||
{19: 2 }112 |
|
||||
{19: 3 }113 |
|
||||
{19: 4 }114 |
|
||||
|
|
||||
]])
|
||||
command('hi LineNrAbove guifg=blue')
|
||||
screen:expect([[
|
||||
{2: 4 }106 |
|
||||
{2: 3 }107 |
|
||||
{2: 2 }108 |
|
||||
{2: 1 }109 |
|
||||
{1:111 }^110 |
|
||||
{1: 1 }111 |
|
||||
{1: 2 }112 |
|
||||
{1: 3 }113 |
|
||||
{1: 4 }114 |
|
||||
{18: 4 }106 |
|
||||
{18: 3 }107 |
|
||||
{18: 2 }108 |
|
||||
{18: 1 }109 |
|
||||
{19:111 }^110 |
|
||||
{19: 1 }111 |
|
||||
{19: 2 }112 |
|
||||
{19: 3 }113 |
|
||||
{19: 4 }114 |
|
||||
|
|
||||
]])
|
||||
command('hi LineNrBelow guifg=green')
|
||||
screen:expect([[
|
||||
{2: 4 }106 |
|
||||
{2: 3 }107 |
|
||||
{2: 2 }108 |
|
||||
{2: 1 }109 |
|
||||
{1:111 }^110 |
|
||||
{3: 1 }111 |
|
||||
{3: 2 }112 |
|
||||
{3: 3 }113 |
|
||||
{3: 4 }114 |
|
||||
{18: 4 }106 |
|
||||
{18: 3 }107 |
|
||||
{18: 2 }108 |
|
||||
{18: 1 }109 |
|
||||
{19:111 }^110 |
|
||||
{100: 1 }111 |
|
||||
{100: 2 }112 |
|
||||
{100: 3 }113 |
|
||||
{100: 4 }114 |
|
||||
|
|
||||
]])
|
||||
command('hi clear LineNrAbove')
|
||||
screen:expect([[
|
||||
{1: 4 }106 |
|
||||
{1: 3 }107 |
|
||||
{1: 2 }108 |
|
||||
{1: 1 }109 |
|
||||
{1:111 }^110 |
|
||||
{3: 1 }111 |
|
||||
{3: 2 }112 |
|
||||
{3: 3 }113 |
|
||||
{3: 4 }114 |
|
||||
{19: 4 }106 |
|
||||
{19: 3 }107 |
|
||||
{19: 2 }108 |
|
||||
{19: 1 }109 |
|
||||
{19:111 }^110 |
|
||||
{100: 1 }111 |
|
||||
{100: 2 }112 |
|
||||
{100: 3 }113 |
|
||||
{100: 4 }114 |
|
||||
|
|
||||
]])
|
||||
end)
|
||||
@@ -79,12 +77,11 @@ describe("'number' and 'relativenumber'", function()
|
||||
-- oldtest: Test_relativenumber_colors_wrapped()
|
||||
it('LineNr, LineNrAbove and LineNrBelow with wrapped lines', function()
|
||||
local screen = Screen.new(50, 20)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { background = Screen.colors.Red, foreground = Screen.colors.Black },
|
||||
[2] = { background = Screen.colors.Blue, foreground = Screen.colors.Black },
|
||||
[3] = { background = Screen.colors.Green, foreground = Screen.colors.Black },
|
||||
[4] = { bold = true, foreground = Screen.colors.Blue },
|
||||
})
|
||||
screen:add_extra_attr_ids {
|
||||
[100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Red },
|
||||
[101] = { foreground = Screen.colors.Gray0, background = Screen.colors.Blue1 },
|
||||
[102] = { foreground = Screen.colors.Gray0, background = Screen.colors.WebGreen },
|
||||
}
|
||||
exec([[
|
||||
set display=lastline scrolloff=0
|
||||
call setline(1, range(200)->map('v:val->string()->repeat(40)'))
|
||||
@@ -95,117 +92,117 @@ describe("'number' and 'relativenumber'", function()
|
||||
hi LineNrBelow guibg=green guifg=black
|
||||
]])
|
||||
screen:expect([[
|
||||
{2: 2 }1081081081081081081081081081081081081081081081|
|
||||
{2: }0810810810810810810810810810810810810810810810|
|
||||
{2: }8108108108108108108108108108 |
|
||||
{2: 1 }1091091091091091091091091091091091091091091091|
|
||||
{2: }0910910910910910910910910910910910910910910910|
|
||||
{2: }9109109109109109109109109109 |
|
||||
{1:111 }^1101101101101101101101101101101101101101101101|
|
||||
{1: }1011011011011011011011011011011011011011011011|
|
||||
{1: }0110110110110110110110110110 |
|
||||
{3: 1 }1111111111111111111111111111111111111111111111|
|
||||
{3: }1111111111111111111111111111111111111111111111|
|
||||
{3: }1111111111111111111111111111 |
|
||||
{3: 2 }1121121121121121121121121121121121121121121121|
|
||||
{3: }1211211211211211211211211211211211211211211211|
|
||||
{3: }2112112112112112112112112112 |
|
||||
{3: 3 }1131131131131131131131131131131131131131131131|
|
||||
{3: }1311311311311311311311311311311311311311311311|
|
||||
{3: }3113113113113113113113113113 |
|
||||
{3: 4 }1141141141141141141141141141141141141141141{4:@@@}|
|
||||
{101: 2 }1081081081081081081081081081081081081081081081|
|
||||
{101: }0810810810810810810810810810810810810810810810|
|
||||
{101: }8108108108108108108108108108 |
|
||||
{101: 1 }1091091091091091091091091091091091091091091091|
|
||||
{101: }0910910910910910910910910910910910910910910910|
|
||||
{101: }9109109109109109109109109109 |
|
||||
{100:111 }^1101101101101101101101101101101101101101101101|
|
||||
{100: }1011011011011011011011011011011011011011011011|
|
||||
{100: }0110110110110110110110110110 |
|
||||
{102: 1 }1111111111111111111111111111111111111111111111|
|
||||
{102: }1111111111111111111111111111111111111111111111|
|
||||
{102: }1111111111111111111111111111 |
|
||||
{102: 2 }1121121121121121121121121121121121121121121121|
|
||||
{102: }1211211211211211211211211211211211211211211211|
|
||||
{102: }2112112112112112112112112112 |
|
||||
{102: 3 }1131131131131131131131131131131131131131131131|
|
||||
{102: }1311311311311311311311311311311311311311311311|
|
||||
{102: }3113113113113113113113113113 |
|
||||
{102: 4 }1141141141141141141141141141141141141141141{1:@@@}|
|
||||
|
|
||||
]])
|
||||
feed('k')
|
||||
screen:expect([[
|
||||
{2: 1 }1081081081081081081081081081081081081081081081|
|
||||
{2: }0810810810810810810810810810810810810810810810|
|
||||
{2: }8108108108108108108108108108 |
|
||||
{1:110 }^1091091091091091091091091091091091091091091091|
|
||||
{1: }0910910910910910910910910910910910910910910910|
|
||||
{1: }9109109109109109109109109109 |
|
||||
{3: 1 }1101101101101101101101101101101101101101101101|
|
||||
{3: }1011011011011011011011011011011011011011011011|
|
||||
{3: }0110110110110110110110110110 |
|
||||
{3: 2 }1111111111111111111111111111111111111111111111|
|
||||
{3: }1111111111111111111111111111111111111111111111|
|
||||
{3: }1111111111111111111111111111 |
|
||||
{3: 3 }1121121121121121121121121121121121121121121121|
|
||||
{3: }1211211211211211211211211211211211211211211211|
|
||||
{3: }2112112112112112112112112112 |
|
||||
{3: 4 }1131131131131131131131131131131131131131131131|
|
||||
{3: }1311311311311311311311311311311311311311311311|
|
||||
{3: }3113113113113113113113113113 |
|
||||
{3: 5 }1141141141141141141141141141141141141141141{4:@@@}|
|
||||
{101: 1 }1081081081081081081081081081081081081081081081|
|
||||
{101: }0810810810810810810810810810810810810810810810|
|
||||
{101: }8108108108108108108108108108 |
|
||||
{100:110 }^1091091091091091091091091091091091091091091091|
|
||||
{100: }0910910910910910910910910910910910910910910910|
|
||||
{100: }9109109109109109109109109109 |
|
||||
{102: 1 }1101101101101101101101101101101101101101101101|
|
||||
{102: }1011011011011011011011011011011011011011011011|
|
||||
{102: }0110110110110110110110110110 |
|
||||
{102: 2 }1111111111111111111111111111111111111111111111|
|
||||
{102: }1111111111111111111111111111111111111111111111|
|
||||
{102: }1111111111111111111111111111 |
|
||||
{102: 3 }1121121121121121121121121121121121121121121121|
|
||||
{102: }1211211211211211211211211211211211211211211211|
|
||||
{102: }2112112112112112112112112112 |
|
||||
{102: 4 }1131131131131131131131131131131131131131131131|
|
||||
{102: }1311311311311311311311311311311311311311311311|
|
||||
{102: }3113113113113113113113113113 |
|
||||
{102: 5 }1141141141141141141141141141141141141141141{1:@@@}|
|
||||
|
|
||||
]])
|
||||
feed('2j')
|
||||
screen:expect([[
|
||||
{2: 3 }1081081081081081081081081081081081081081081081|
|
||||
{2: }0810810810810810810810810810810810810810810810|
|
||||
{2: }8108108108108108108108108108 |
|
||||
{2: 2 }1091091091091091091091091091091091091091091091|
|
||||
{2: }0910910910910910910910910910910910910910910910|
|
||||
{2: }9109109109109109109109109109 |
|
||||
{2: 1 }1101101101101101101101101101101101101101101101|
|
||||
{2: }1011011011011011011011011011011011011011011011|
|
||||
{2: }0110110110110110110110110110 |
|
||||
{1:112 }^1111111111111111111111111111111111111111111111|
|
||||
{1: }1111111111111111111111111111111111111111111111|
|
||||
{1: }1111111111111111111111111111 |
|
||||
{3: 1 }1121121121121121121121121121121121121121121121|
|
||||
{3: }1211211211211211211211211211211211211211211211|
|
||||
{3: }2112112112112112112112112112 |
|
||||
{3: 2 }1131131131131131131131131131131131131131131131|
|
||||
{3: }1311311311311311311311311311311311311311311311|
|
||||
{3: }3113113113113113113113113113 |
|
||||
{3: 3 }1141141141141141141141141141141141141141141{4:@@@}|
|
||||
{101: 3 }1081081081081081081081081081081081081081081081|
|
||||
{101: }0810810810810810810810810810810810810810810810|
|
||||
{101: }8108108108108108108108108108 |
|
||||
{101: 2 }1091091091091091091091091091091091091091091091|
|
||||
{101: }0910910910910910910910910910910910910910910910|
|
||||
{101: }9109109109109109109109109109 |
|
||||
{101: 1 }1101101101101101101101101101101101101101101101|
|
||||
{101: }1011011011011011011011011011011011011011011011|
|
||||
{101: }0110110110110110110110110110 |
|
||||
{100:112 }^1111111111111111111111111111111111111111111111|
|
||||
{100: }1111111111111111111111111111111111111111111111|
|
||||
{100: }1111111111111111111111111111 |
|
||||
{102: 1 }1121121121121121121121121121121121121121121121|
|
||||
{102: }1211211211211211211211211211211211211211211211|
|
||||
{102: }2112112112112112112112112112 |
|
||||
{102: 2 }1131131131131131131131131131131131131131131131|
|
||||
{102: }1311311311311311311311311311311311311311311311|
|
||||
{102: }3113113113113113113113113113 |
|
||||
{102: 3 }1141141141141141141141141141141141141141141{1:@@@}|
|
||||
|
|
||||
]])
|
||||
feed('2j')
|
||||
screen:expect([[
|
||||
{2: 5 }1081081081081081081081081081081081081081081081|
|
||||
{2: }0810810810810810810810810810810810810810810810|
|
||||
{2: }8108108108108108108108108108 |
|
||||
{2: 4 }1091091091091091091091091091091091091091091091|
|
||||
{2: }0910910910910910910910910910910910910910910910|
|
||||
{2: }9109109109109109109109109109 |
|
||||
{2: 3 }1101101101101101101101101101101101101101101101|
|
||||
{2: }1011011011011011011011011011011011011011011011|
|
||||
{2: }0110110110110110110110110110 |
|
||||
{2: 2 }1111111111111111111111111111111111111111111111|
|
||||
{2: }1111111111111111111111111111111111111111111111|
|
||||
{2: }1111111111111111111111111111 |
|
||||
{2: 1 }1121121121121121121121121121121121121121121121|
|
||||
{2: }1211211211211211211211211211211211211211211211|
|
||||
{2: }2112112112112112112112112112 |
|
||||
{1:114 }^1131131131131131131131131131131131131131131131|
|
||||
{1: }1311311311311311311311311311311311311311311311|
|
||||
{1: }3113113113113113113113113113 |
|
||||
{3: 1 }1141141141141141141141141141141141141141141{4:@@@}|
|
||||
{101: 5 }1081081081081081081081081081081081081081081081|
|
||||
{101: }0810810810810810810810810810810810810810810810|
|
||||
{101: }8108108108108108108108108108 |
|
||||
{101: 4 }1091091091091091091091091091091091091091091091|
|
||||
{101: }0910910910910910910910910910910910910910910910|
|
||||
{101: }9109109109109109109109109109 |
|
||||
{101: 3 }1101101101101101101101101101101101101101101101|
|
||||
{101: }1011011011011011011011011011011011011011011011|
|
||||
{101: }0110110110110110110110110110 |
|
||||
{101: 2 }1111111111111111111111111111111111111111111111|
|
||||
{101: }1111111111111111111111111111111111111111111111|
|
||||
{101: }1111111111111111111111111111 |
|
||||
{101: 1 }1121121121121121121121121121121121121121121121|
|
||||
{101: }1211211211211211211211211211211211211211211211|
|
||||
{101: }2112112112112112112112112112 |
|
||||
{100:114 }^1131131131131131131131131131131131131131131131|
|
||||
{100: }1311311311311311311311311311311311311311311311|
|
||||
{100: }3113113113113113113113113113 |
|
||||
{102: 1 }1141141141141141141141141141141141141141141{1:@@@}|
|
||||
|
|
||||
]])
|
||||
feed('k')
|
||||
screen:expect([[
|
||||
{2: 4 }1081081081081081081081081081081081081081081081|
|
||||
{2: }0810810810810810810810810810810810810810810810|
|
||||
{2: }8108108108108108108108108108 |
|
||||
{2: 3 }1091091091091091091091091091091091091091091091|
|
||||
{2: }0910910910910910910910910910910910910910910910|
|
||||
{2: }9109109109109109109109109109 |
|
||||
{2: 2 }1101101101101101101101101101101101101101101101|
|
||||
{2: }1011011011011011011011011011011011011011011011|
|
||||
{2: }0110110110110110110110110110 |
|
||||
{2: 1 }1111111111111111111111111111111111111111111111|
|
||||
{2: }1111111111111111111111111111111111111111111111|
|
||||
{2: }1111111111111111111111111111 |
|
||||
{1:113 }^1121121121121121121121121121121121121121121121|
|
||||
{1: }1211211211211211211211211211211211211211211211|
|
||||
{1: }2112112112112112112112112112 |
|
||||
{3: 1 }1131131131131131131131131131131131131131131131|
|
||||
{3: }1311311311311311311311311311311311311311311311|
|
||||
{3: }3113113113113113113113113113 |
|
||||
{3: 2 }1141141141141141141141141141141141141141141{4:@@@}|
|
||||
{101: 4 }1081081081081081081081081081081081081081081081|
|
||||
{101: }0810810810810810810810810810810810810810810810|
|
||||
{101: }8108108108108108108108108108 |
|
||||
{101: 3 }1091091091091091091091091091091091091091091091|
|
||||
{101: }0910910910910910910910910910910910910910910910|
|
||||
{101: }9109109109109109109109109109 |
|
||||
{101: 2 }1101101101101101101101101101101101101101101101|
|
||||
{101: }1011011011011011011011011011011011011011011011|
|
||||
{101: }0110110110110110110110110110 |
|
||||
{101: 1 }1111111111111111111111111111111111111111111111|
|
||||
{101: }1111111111111111111111111111111111111111111111|
|
||||
{101: }1111111111111111111111111111 |
|
||||
{100:113 }^1121121121121121121121121121121121121121121121|
|
||||
{100: }1211211211211211211211211211211211211211211211|
|
||||
{100: }2112112112112112112112112112 |
|
||||
{102: 1 }1131131131131131131131131131131131131131131131|
|
||||
{102: }1311311311311311311311311311311311311311311311|
|
||||
{102: }3113113113113113113113113113 |
|
||||
{102: 2 }1141141141141141141141141141141141141141141{1:@@@}|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
@@ -1202,14 +1202,9 @@ describe('smoothscroll', function()
|
||||
|
||||
it('<<< marker shows with tabline, winbar and splits', function()
|
||||
screen:try_resize(40, 12)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { foreground = Screen.colors.Blue1, bold = true },
|
||||
[2] = { reverse = true },
|
||||
[3] = { bold = true, reverse = true },
|
||||
[4] = { background = Screen.colors.LightMagenta },
|
||||
[5] = { bold = true },
|
||||
[31] = { foreground = Screen.colors.Fuchsia, bold = true },
|
||||
})
|
||||
screen:add_extra_attr_ids {
|
||||
[100] = { foreground = Screen.colors.Magenta1, bold = true },
|
||||
}
|
||||
exec([[
|
||||
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
|
||||
set smoothscroll scrolloff=0
|
||||
@@ -1232,7 +1227,7 @@ describe('smoothscroll', function()
|
||||
exec('set showtabline=2')
|
||||
feed('<C-E>')
|
||||
screen:expect([[
|
||||
{5: }{31:2}{5:+ [No Name] }{2: }|
|
||||
{5: }{100:2}{5:+ [No Name] }{2: }|
|
||||
{1:<<<}e text with some text with some text |
|
||||
with some text with some text |
|
||||
Line with some text with some text with |
|
||||
@@ -1248,7 +1243,7 @@ describe('smoothscroll', function()
|
||||
exec('set winbar=winbar')
|
||||
feed('<C-w>k<C-E>')
|
||||
screen:expect([[
|
||||
{5: }{31:2}{5:+ [No Name] }{2: }|
|
||||
{5: }{100:2}{5:+ [No Name] }{2: }|
|
||||
{5:winbar }|
|
||||
{1:<<<}e text with some text with some text |
|
||||
^with some text with some text |
|
||||
|
@@ -18,13 +18,6 @@ describe('search cmdline', function()
|
||||
clear()
|
||||
command('set nohlsearch inccommand=')
|
||||
screen = Screen.new(20, 3)
|
||||
screen:set_default_attr_ids({
|
||||
inc = { reverse = true },
|
||||
err = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
||||
more = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
||||
tilde = { bold = true, foreground = Screen.colors.Blue1 },
|
||||
hl = { background = Screen.colors.Yellow },
|
||||
})
|
||||
end)
|
||||
|
||||
local function tenlines()
|
||||
@@ -60,57 +53,57 @@ describe('search cmdline', function()
|
||||
feed('/the')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 {inc:the} |
|
||||
3 {2:the} |
|
||||
/the^ |
|
||||
]])
|
||||
eq({ 0, 0, 0, 0 }, fn.getpos('"'))
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
3 the |
|
||||
4 {inc:the}ir |
|
||||
4 {2:the}ir |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
4 their |
|
||||
5 {inc:the}re |
|
||||
5 {2:the}re |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
5 there |
|
||||
6 {inc:the}ir |
|
||||
6 {2:the}ir |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
6 their |
|
||||
7 {inc:the} |
|
||||
7 {2:the} |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
7 the |
|
||||
8 {inc:the}m |
|
||||
8 {2:the}m |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
8 them |
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
screen.bell = false
|
||||
feed('<C-G>')
|
||||
if wrapscan == 'wrapscan' then
|
||||
screen:expect([[
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
3 the |
|
||||
/the^ |
|
||||
]])
|
||||
@@ -118,7 +111,7 @@ describe('search cmdline', function()
|
||||
screen:expect {
|
||||
grid = [[
|
||||
8 them |
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
/the^ |
|
||||
]],
|
||||
condition = function()
|
||||
@@ -136,7 +129,7 @@ describe('search cmdline', function()
|
||||
|
||||
feed('?the')
|
||||
screen:expect([[
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
10 foobar |
|
||||
?the^ |
|
||||
]])
|
||||
@@ -144,7 +137,7 @@ describe('search cmdline', function()
|
||||
if wrapscan == 'wrapscan' then
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
3 the |
|
||||
?the^ |
|
||||
]])
|
||||
@@ -158,7 +151,7 @@ describe('search cmdline', function()
|
||||
feed('<C-G>')
|
||||
screen:expect {
|
||||
grid = [[
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
10 foobar |
|
||||
?the^ |
|
||||
]],
|
||||
@@ -176,13 +169,13 @@ describe('search cmdline', function()
|
||||
command('$')
|
||||
feed('?the')
|
||||
screen:expect([[
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
10 foobar |
|
||||
?the^ |
|
||||
]])
|
||||
feed('<C-T>')
|
||||
screen:expect([[
|
||||
8 {inc:the}m |
|
||||
8 {2:the}m |
|
||||
9 these |
|
||||
?the^ |
|
||||
]])
|
||||
@@ -195,7 +188,7 @@ describe('search cmdline', function()
|
||||
end
|
||||
end
|
||||
screen:expect([[
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
3 the |
|
||||
?the^ |
|
||||
]])
|
||||
@@ -203,14 +196,14 @@ describe('search cmdline', function()
|
||||
feed('<C-T>')
|
||||
if wrapscan == 'wrapscan' then
|
||||
screen:expect([[
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
10 foobar |
|
||||
?the^ |
|
||||
]])
|
||||
else
|
||||
screen:expect {
|
||||
grid = [[
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
3 the |
|
||||
?the^ |
|
||||
]],
|
||||
@@ -245,24 +238,24 @@ describe('search cmdline', function()
|
||||
feed('/the')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-L>')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:thes}e |
|
||||
2 {2:thes}e |
|
||||
/thes^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
9 {inc:thes}e |
|
||||
9 {2:thes}e |
|
||||
10 foobar |
|
||||
/thes^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 {inc:thes}e |
|
||||
2 {2:thes}e |
|
||||
3 the |
|
||||
/thes^ |
|
||||
]])
|
||||
@@ -278,18 +271,18 @@ describe('search cmdline', function()
|
||||
feed('/the')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-L>')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:thes}e |
|
||||
2 {2:thes}e |
|
||||
/thes^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
9 {inc:thes}e |
|
||||
9 {2:thes}e |
|
||||
10 foobar |
|
||||
/thes^ |
|
||||
]])
|
||||
@@ -309,41 +302,41 @@ describe('search cmdline', function()
|
||||
feed('/thei')
|
||||
screen:expect([[
|
||||
3 the |
|
||||
4 {inc:thei}r |
|
||||
4 {2:thei}r |
|
||||
/thei^ |
|
||||
]])
|
||||
-- Match from initial cursor position when modifying search
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
-- New text advances to next match
|
||||
feed('s')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:thes}e |
|
||||
2 {2:thes}e |
|
||||
/thes^ |
|
||||
]])
|
||||
-- Stay on this match when deleting a character
|
||||
feed('<BS>')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
-- Advance to previous match
|
||||
feed('<C-T>')
|
||||
screen:expect([[
|
||||
9 {inc:the}se |
|
||||
9 {2:the}se |
|
||||
10 foobar |
|
||||
/the^ |
|
||||
]])
|
||||
-- Extend search to include next character
|
||||
feed('<C-L>')
|
||||
screen:expect([[
|
||||
9 {inc:thes}e |
|
||||
9 {2:thes}e |
|
||||
10 foobar |
|
||||
/thes^ |
|
||||
]])
|
||||
@@ -357,13 +350,13 @@ describe('search cmdline', function()
|
||||
feed('the')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
feed('\\>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 {inc:the} |
|
||||
3 {2:the} |
|
||||
/the\>^ |
|
||||
]])
|
||||
end)
|
||||
@@ -377,7 +370,7 @@ describe('search cmdline', function()
|
||||
feed('/the')
|
||||
screen:expect([[
|
||||
1 |
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
/the^ |
|
||||
]])
|
||||
|
||||
@@ -385,7 +378,7 @@ describe('search cmdline', function()
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 {inc:the} theother |
|
||||
3 {2:the} theother |
|
||||
/the^ |
|
||||
]])
|
||||
|
||||
@@ -393,13 +386,13 @@ describe('search cmdline', function()
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 the {inc:the}other |
|
||||
3 the {2:the}other |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 the theo{inc:the}r |
|
||||
3 the theo{2:the}r |
|
||||
/the^ |
|
||||
]])
|
||||
|
||||
@@ -407,20 +400,20 @@ describe('search cmdline', function()
|
||||
feed('<C-T>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 the {inc:the}other |
|
||||
3 the {2:the}other |
|
||||
/the^ |
|
||||
]])
|
||||
feed('<C-T>')
|
||||
screen:expect([[
|
||||
2 these |
|
||||
3 {inc:the} theother |
|
||||
3 {2:the} theother |
|
||||
/the^ |
|
||||
]])
|
||||
|
||||
-- Previous match, different line
|
||||
feed('<C-T>')
|
||||
screen:expect([[
|
||||
2 {inc:the}se |
|
||||
2 {2:the}se |
|
||||
3 the theother |
|
||||
/the^ |
|
||||
]])
|
||||
@@ -436,7 +429,7 @@ describe('search cmdline', function()
|
||||
7 the |
|
||||
8 them |
|
||||
9 these |
|
||||
10 {inc:foo}bar |
|
||||
10 {2:foo}bar |
|
||||
/foo^ |
|
||||
]])
|
||||
feed('<BS>')
|
||||
@@ -445,7 +438,7 @@ describe('search cmdline', function()
|
||||
7 the |
|
||||
8 them |
|
||||
9 these |
|
||||
10 {inc:fo}obar |
|
||||
10 {2:fo}obar |
|
||||
/fo^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
@@ -476,7 +469,7 @@ describe('search cmdline', function()
|
||||
feed('/foo')
|
||||
screen:expect([[
|
||||
9 these |
|
||||
10 {inc:foo}bar |
|
||||
10 {2:foo}bar |
|
||||
/foo^ |
|
||||
]])
|
||||
feed('<C-W>')
|
||||
@@ -488,8 +481,8 @@ describe('search cmdline', function()
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
/ |
|
||||
{err:E35: No previous regular expression} |
|
||||
{more:Press ENTER or type command to continue}^ |
|
||||
{9:E35: No previous regular expression} |
|
||||
{6:Press ENTER or type command to continue}^ |
|
||||
]])
|
||||
feed('<CR>')
|
||||
eq({
|
||||
@@ -613,9 +606,9 @@ describe('search cmdline', function()
|
||||
|
||||
feed(':sort ni u /on')
|
||||
screen:expect([[
|
||||
another {inc:on}e 2 |
|
||||
that {hl:on}e 3 |
|
||||
the {hl:on}e 1 |
|
||||
another {2:on}e 2 |
|
||||
that {10:on}e 3 |
|
||||
the {10:on}e 1 |
|
||||
:sort ni u /on^ |
|
||||
]])
|
||||
feed('<esc>')
|
||||
@@ -629,27 +622,27 @@ describe('search cmdline', function()
|
||||
|
||||
feed(':vimgrep on')
|
||||
screen:expect([[
|
||||
another {inc:on}e 2 |
|
||||
that {hl:on}e 3 |
|
||||
the {hl:on}e 1 |
|
||||
another {2:on}e 2 |
|
||||
that {10:on}e 3 |
|
||||
the {10:on}e 1 |
|
||||
:vimgrep on^ |
|
||||
]])
|
||||
feed('<esc>')
|
||||
|
||||
feed(':vimg /on/ *.txt')
|
||||
screen:expect([[
|
||||
another {inc:on}e 2 |
|
||||
that {hl:on}e 3 |
|
||||
the {hl:on}e 1 |
|
||||
another {2:on}e 2 |
|
||||
that {10:on}e 3 |
|
||||
the {10:on}e 1 |
|
||||
:vimg /on/ *.txt^ |
|
||||
]])
|
||||
feed('<esc>')
|
||||
|
||||
feed(':vimgrepadd "\\<LT>on')
|
||||
screen:expect([[
|
||||
another {inc:on}e 2 |
|
||||
that {hl:on}e 3 |
|
||||
the {hl:on}e 1 |
|
||||
another {2:on}e 2 |
|
||||
that {10:on}e 3 |
|
||||
the {10:on}e 1 |
|
||||
:vimgrepadd "\<on^ |
|
||||
]])
|
||||
feed('<esc>')
|
||||
@@ -657,7 +650,7 @@ describe('search cmdline', function()
|
||||
feed(':lv "tha')
|
||||
screen:expect([[
|
||||
another one 2 |
|
||||
{inc:tha}t one 3 |
|
||||
{2:tha}t one 3 |
|
||||
the one 1 |
|
||||
:lv "tha^ |
|
||||
]])
|
||||
@@ -665,9 +658,9 @@ describe('search cmdline', function()
|
||||
|
||||
feed(':lvimgrepa "the" **/*.txt')
|
||||
screen:expect([[
|
||||
ano{inc:the}r one 2 |
|
||||
ano{2:the}r one 2 |
|
||||
that one 3 |
|
||||
{hl:the} one 1 |
|
||||
{10:the} one 1 |
|
||||
:lvimgrepa "the" **/*.txt^ |
|
||||
]])
|
||||
feed('<esc>')
|
||||
@@ -718,7 +711,7 @@ describe('search cmdline', function()
|
||||
call feedkeys("2\<C-E>", 't')
|
||||
]])
|
||||
local s = [[
|
||||
{tilde:<<<} 18 19 20 21 22 2|
|
||||
{1:<<<} 18 19 20 21 22 2|
|
||||
^3 24 |
|
||||
|*4
|
||||
]]
|
||||
@@ -726,13 +719,13 @@ describe('search cmdline', function()
|
||||
feed('/xx')
|
||||
screen:expect([[
|
||||
|*4
|
||||
{inc:xx}x |
|
||||
{2:xx}x |
|
||||
/xx^ |
|
||||
]])
|
||||
feed('x')
|
||||
screen:expect([[
|
||||
|*4
|
||||
{inc:xxx} |
|
||||
{2:xxx} |
|
||||
/xxx^ |
|
||||
]])
|
||||
feed('<Esc>')
|
||||
@@ -764,13 +757,14 @@ describe('Search highlight', function()
|
||||
-- oldtest: Test_hlsearch_and_visual()
|
||||
it('is combined with Visual highlight vim-patch:8.2.2797', function()
|
||||
local screen = Screen.new(40, 6)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[2] = { bold = true }, -- ModeMsg, Search
|
||||
[3] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual
|
||||
[4] = { background = Screen.colors.Yellow, bold = true }, -- Search
|
||||
[5] = { background = Screen.colors.LightGrey, bold = true, foreground = Screen.colors.Black },
|
||||
})
|
||||
screen:add_extra_attr_ids {
|
||||
[100] = {
|
||||
foreground = Screen.colors.Black,
|
||||
bold = true,
|
||||
background = Screen.colors.LightGrey,
|
||||
},
|
||||
[101] = { bold = true, background = Screen.colors.Yellow },
|
||||
}
|
||||
exec([[
|
||||
set hlsearch noincsearch
|
||||
call setline(1, repeat(["xxx yyy zzz"], 3))
|
||||
@@ -780,11 +774,11 @@ describe('Search highlight', function()
|
||||
]])
|
||||
feed('vjj')
|
||||
screen:expect([[
|
||||
xxx {4:y}{5:yy}{3: zzz} |
|
||||
{3:xxx }{5:yyy}{3: zzz} |
|
||||
{3:xxx }{5:y}{4:^yy} zzz |
|
||||
xxx {101:y}{100:yy}{17: zzz} |
|
||||
{17:xxx }{100:yyy}{17: zzz} |
|
||||
{17:xxx }{100:y}{101:^yy} zzz |
|
||||
{1:~ }|*2
|
||||
{2:-- VISUAL --} |
|
||||
{5:-- VISUAL --} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@@ -8,13 +8,6 @@ describe('search stat', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
screen = Screen.new(30, 10)
|
||||
screen:set_default_attr_ids({
|
||||
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
|
||||
[2] = { background = Screen.colors.Yellow }, -- Search
|
||||
[3] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, -- Folded
|
||||
[4] = { reverse = true }, -- IncSearch, TabLineFill
|
||||
[5] = { foreground = Screen.colors.Red }, -- WarningMsg
|
||||
})
|
||||
end)
|
||||
|
||||
-- oldtest: Test_search_stat_screendump()
|
||||
@@ -32,7 +25,7 @@ describe('search stat', function()
|
||||
]])
|
||||
screen:expect([[
|
||||
foobar |
|
||||
{2:^find this} |
|
||||
{10:^find this} |
|
||||
fooooobar |
|
||||
foba |
|
||||
foobar |*2
|
||||
@@ -45,7 +38,7 @@ describe('search stat', function()
|
||||
feed('gg0n')
|
||||
screen:expect([[
|
||||
foobar |
|
||||
{2:^find this} |
|
||||
{10:^find this} |
|
||||
fooooobar |
|
||||
foba |
|
||||
foobar |*2
|
||||
@@ -68,7 +61,7 @@ describe('search stat', function()
|
||||
]])
|
||||
screen:expect([[
|
||||
if |
|
||||
{3:^+-- 2 lines: foo·············}|
|
||||
{13:^+-- 2 lines: foo·············}|
|
||||
endif |
|
||||
|
|
||||
{1:~ }|*5
|
||||
@@ -91,16 +84,16 @@ describe('search stat', function()
|
||||
feed('/dog<CR>')
|
||||
screen:expect([[
|
||||
int cat; |
|
||||
int {2:^dog}; |
|
||||
cat = {2:dog}; |
|
||||
int {10:^dog}; |
|
||||
cat = {10:dog}; |
|
||||
{1:~ }|*6
|
||||
/dog [1/2] |
|
||||
]])
|
||||
feed('G0gD')
|
||||
screen:expect([[
|
||||
int {2:^cat}; |
|
||||
int {10:^cat}; |
|
||||
int dog; |
|
||||
{2:cat} = dog; |
|
||||
{10:cat} = dog; |
|
||||
{1:~ }|*6
|
||||
|
|
||||
]])
|
||||
@@ -128,9 +121,19 @@ describe('search stat', function()
|
||||
|
||||
feed('/abc')
|
||||
screen:expect([[
|
||||
{4: }|
|
||||
{2:abc}--c |
|
||||
--------{4:abc} |
|
||||
{2: }|
|
||||
{10:abc}--c |
|
||||
--------{2:abc} |
|
||||
--{10:abc} |
|
||||
{1:~ }|*5
|
||||
/abc^ |
|
||||
]])
|
||||
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
{2:3/3 }|
|
||||
{10:abc}--c |
|
||||
--------{10:abc} |
|
||||
--{2:abc} |
|
||||
{1:~ }|*5
|
||||
/abc^ |
|
||||
@@ -138,20 +141,10 @@ describe('search stat', function()
|
||||
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
{4:3/3 }|
|
||||
{2:1/3 }|
|
||||
{2:abc}--c |
|
||||
--------{2:abc} |
|
||||
--{4:abc} |
|
||||
{1:~ }|*5
|
||||
/abc^ |
|
||||
]])
|
||||
|
||||
feed('<C-G>')
|
||||
screen:expect([[
|
||||
{4:1/3 }|
|
||||
{4:abc}--c |
|
||||
--------{2:abc} |
|
||||
--{2:abc} |
|
||||
--------{10:abc} |
|
||||
--{10:abc} |
|
||||
{1:~ }|*5
|
||||
/abc^ |
|
||||
]])
|
||||
@@ -167,7 +160,7 @@ describe('search stat', function()
|
||||
|
||||
feed('*')
|
||||
screen:expect([[
|
||||
{2:^test} |
|
||||
{10:^test} |
|
||||
|
|
||||
{1:~ }|*7
|
||||
/\<test\> [1/1] |
|
||||
@@ -175,7 +168,7 @@ describe('search stat', function()
|
||||
|
||||
feed('N')
|
||||
screen:expect([[
|
||||
{2:^test} |
|
||||
{10:^test} |
|
||||
|
|
||||
{1:~ }|*7
|
||||
?\<test\> [1/1] |
|
||||
@@ -185,10 +178,10 @@ describe('search stat', function()
|
||||
feed('N')
|
||||
-- shows "Search Hit Bottom.."
|
||||
screen:expect([[
|
||||
{2:^test} |
|
||||
{10:^test} |
|
||||
|
|
||||
{1:~ }|*7
|
||||
{5:search hit TOP, continuing at BOTTOM} |
|
||||
{19:search hit TOP, continuing at BOTTOM} |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user