refactor(tests): use new-style highlight spec in legacy/

This commit is contained in:
bfredl
2025-02-24 10:18:37 +01:00
parent 47cfe901d7
commit 90a63d242a
8 changed files with 422 additions and 464 deletions

View File

@@ -12,11 +12,6 @@ describe('breakindent', function()
-- oldtest: Test_cursor_position_with_showbreak() -- oldtest: Test_cursor_position_with_showbreak()
it('cursor shown at correct position with showbreak', function() it('cursor shown at correct position with showbreak', 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.Grey, foreground = Screen.colors.DarkBlue }, -- SignColumn
[2] = { bold = true }, -- ModeMsg
})
exec([[ exec([[
set listchars=eol:$ set listchars=eol:$
let &signcolumn = 'yes' let &signcolumn = 'yes'
@@ -29,10 +24,10 @@ describe('breakindent', function()
feed('AX') feed('AX')
screen:expect([[ screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: }^second line | {7: }^second line |
{0:~ }|*3 {1:~ }|*3
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
-- No line wraps, so changing 'showbreak' should lead to the same screen. -- No line wraps, so changing 'showbreak' should lead to the same screen.
command('setlocal showbreak=+') command('setlocal showbreak=+')
@@ -43,19 +38,19 @@ describe('breakindent', function()
-- The first line now wraps because of "eol" in 'listchars'. -- The first line now wraps because of "eol" in 'listchars'.
command('setlocal list') command('setlocal list')
screen:expect([[ screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: } {0:+^$} | {7: } {1:+^$} |
{1: }second line{0:$} | {7: }second line{1:$} |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
command('setlocal nobreakindent') command('setlocal nobreakindent')
screen:expect([[ screen:expect([[
{1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX| {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
{1: }{0:+^$} | {7: }{1:+^$} |
{1: }second line{0:$} | {7: }second line{1:$} |
{0:~ }|*2 {1:~ }|*2
{2:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
end) end)

View File

@@ -294,41 +294,34 @@ describe('cmdwin', function()
-- oldtest: Test_cmdwin_interrupted() -- oldtest: Test_cmdwin_interrupted()
it('still uses a new buffer when interrupting more prompt on open', function() it('still uses a new buffer when interrupting more prompt on open', function()
local screen = Screen.new(30, 16) 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('set more')
command('autocmd WinNew * highlight') command('autocmd WinNew * highlight')
feed('q:') feed('q:')
screen:expect({ any = pesc('{3:-- More --}^') }) screen:expect({ any = pesc('{6:-- More --}^') })
feed('q') feed('q')
screen:expect([[ screen:expect([[
| |
{0:~ }|*5 {1:~ }|*5
{2:[No Name] }| {2:[No Name] }|
{0::}^ | {1::}^ |
{0:~ }|*6 {1:~ }|*6
{1:[Command Line] }| {3:[Command Line] }|
| |
]]) ]])
feed([[aecho 'done']]) feed([[aecho 'done']])
screen:expect([[ screen:expect([[
| |
{0:~ }|*5 {1:~ }|*5
{2:[No Name] }| {2:[No Name] }|
{0::}echo 'done'^ | {1::}echo 'done'^ |
{0:~ }|*6 {1:~ }|*6
{1:[Command Line] }| {3:[Command Line] }|
{4:-- INSERT --} | {5:-- INSERT --} |
]]) ]])
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
{0:~ }|*14 {1:~ }|*14
done | done |
]]) ]])
end) end)

View File

@@ -45,11 +45,6 @@ describe('display', function()
local function run_test_display_lastline(euro) local function run_test_display_lastline(euro)
local screen = Screen.new(75, 10) 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([[ exec([[
call setline(1, ['aaa', 'b'->repeat(200)]) call setline(1, ['aaa', 'b'->repeat(200)])
set display=truncate set display=truncate
@@ -68,7 +63,7 @@ describe('display', function()
b│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | b│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
b│{1:~ }|*3 b│{1:~ }|*3
{1:@}│{1:~ }| {1:@}│{1:~ }|
{2:< }{3:[No Name] [+] }| {3:< }{2:[No Name] [+] }|
| |
]]):gsub('@', fillchar))) ]]):gsub('@', fillchar)))
@@ -82,7 +77,7 @@ describe('display', function()
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │b| bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │b|
{1:~ }│b|*3 {1:~ }│b|*3
{1:~ }│{1:@}| {1:~ }│{1:@}|
{2:[No Name] [+] }{3:<}| {3:[No Name] [+] }{2:<}|
| |
]]):gsub('@', fillchar))) ]]):gsub('@', fillchar)))
@@ -95,11 +90,11 @@ describe('display', function()
^aaa | ^aaa |
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb| bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
{1:@@@ }| {1:@@@ }|
{2:[No Name] [+] }| {3:[No Name] [+] }|
aaa | aaa |
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*2 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|*2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
{3:[No Name] [+] }| {2:[No Name] [+] }|
| |
]]):gsub('@', fillchar))) ]]):gsub('@', fillchar)))
@@ -112,7 +107,7 @@ describe('display', function()
bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
bb│{1:~ }|*3 bb│{1:~ }|*3
{1:@@}│{1:~ }| {1:@@}│{1:~ }|
{2:< }{3:[No Name] [+] }| {3:< }{2:[No Name] [+] }|
| |
]]):gsub('@', fillchar))) ]]):gsub('@', fillchar)))
end end

View File

@@ -122,10 +122,6 @@ describe('messages', function()
-- oldtest: Test_message_more() -- oldtest: Test_message_more()
it('works', function() it('works', function()
screen = Screen.new(75, 6) 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))') command('call setline(1, range(1, 100))')
@@ -140,194 +136,194 @@ describe('messages', function()
]]) ]])
feed('\n') feed('\n')
screen:expect([[ screen:expect([[
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('?') feed('?')
screen:expect([[ screen:expect([[
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{1:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ | {6:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ |
]]) ]])
-- Down a line with j, <CR>, <NL> or <Down>. -- Down a line with j, <CR>, <NL> or <Down>.
feed('j') feed('j')
screen:expect([[ screen:expect([[
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{2: 6 }6 | {8: 6 }6 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<NL>') feed('<NL>')
screen:expect([[ screen:expect([[
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{2: 6 }6 | {8: 6 }6 |
{2: 7 }7 | {8: 7 }7 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{2: 6 }6 | {8: 6 }6 |
{2: 7 }7 | {8: 7 }7 |
{2: 8 }8 | {8: 8 }8 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<Down>') feed('<Down>')
screen:expect([[ screen:expect([[
{2: 5 }5 | {8: 5 }5 |
{2: 6 }6 | {8: 6 }6 |
{2: 7 }7 | {8: 7 }7 |
{2: 8 }8 | {8: 8 }8 |
{2: 9 }9 | {8: 9 }9 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Down a screen with <Space>, f, or <PageDown>. -- Down a screen with <Space>, f, or <PageDown>.
feed('f') feed('f')
screen:expect([[ screen:expect([[
{2: 10 }10 | {8: 10 }10 |
{2: 11 }11 | {8: 11 }11 |
{2: 12 }12 | {8: 12 }12 |
{2: 13 }13 | {8: 13 }13 |
{2: 14 }14 | {8: 14 }14 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<Space>') feed('<Space>')
screen:expect([[ screen:expect([[
{2: 15 }15 | {8: 15 }15 |
{2: 16 }16 | {8: 16 }16 |
{2: 17 }17 | {8: 17 }17 |
{2: 18 }18 | {8: 18 }18 |
{2: 19 }19 | {8: 19 }19 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<PageDown>') feed('<PageDown>')
screen:expect([[ screen:expect([[
{2: 20 }20 | {8: 20 }20 |
{2: 21 }21 | {8: 21 }21 |
{2: 22 }22 | {8: 22 }22 |
{2: 23 }23 | {8: 23 }23 |
{2: 24 }24 | {8: 24 }24 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Down a page (half a screen) with d. -- Down a page (half a screen) with d.
feed('d') feed('d')
screen:expect([[ screen:expect([[
{2: 23 }23 | {8: 23 }23 |
{2: 24 }24 | {8: 24 }24 |
{2: 25 }25 | {8: 25 }25 |
{2: 26 }26 | {8: 26 }26 |
{2: 27 }27 | {8: 27 }27 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Down all the way with 'G'. -- Down all the way with 'G'.
feed('G') feed('G')
screen:expect([[ screen:expect([[
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{2: 99 }99 | {8: 99 }99 |
{2:100 }100 | {8:100 }100 |
{1:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
-- Up a line k, <BS> or <Up>. -- Up a line k, <BS> or <Up>.
feed('k') feed('k')
screen:expect([[ screen:expect([[
{2: 95 }95 | {8: 95 }95 |
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{2: 99 }99 | {8: 99 }99 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<BS>') feed('<BS>')
screen:expect([[ screen:expect([[
{2: 94 }94 | {8: 94 }94 |
{2: 95 }95 | {8: 95 }95 |
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<Up>') feed('<Up>')
screen:expect([[ screen:expect([[
{2: 93 }93 | {8: 93 }93 |
{2: 94 }94 | {8: 94 }94 |
{2: 95 }95 | {8: 95 }95 |
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Up a screen with b or <PageUp>. -- Up a screen with b or <PageUp>.
feed('b') feed('b')
screen:expect([[ screen:expect([[
{2: 88 }88 | {8: 88 }88 |
{2: 89 }89 | {8: 89 }89 |
{2: 90 }90 | {8: 90 }90 |
{2: 91 }91 | {8: 91 }91 |
{2: 92 }92 | {8: 92 }92 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed('<PageUp>') feed('<PageUp>')
screen:expect([[ screen:expect([[
{2: 83 }83 | {8: 83 }83 |
{2: 84 }84 | {8: 84 }84 |
{2: 85 }85 | {8: 85 }85 |
{2: 86 }86 | {8: 86 }86 |
{2: 87 }87 | {8: 87 }87 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Up a page (half a screen) with u. -- Up a page (half a screen) with u.
feed('u') feed('u')
screen:expect([[ screen:expect([[
{2: 80 }80 | {8: 80 }80 |
{2: 81 }81 | {8: 81 }81 |
{2: 82 }82 | {8: 82 }82 |
{2: 83 }83 | {8: 83 }83 |
{2: 84 }84 | {8: 84 }84 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Up all the way with 'g'. -- Up all the way with 'g'.
feed('g') feed('g')
screen:expect([[ screen:expect([[
:%p# | :%p# |
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- All the way down. Pressing f should do nothing but pressing -- All the way down. Pressing f should do nothing but pressing
-- space should end the more prompt. -- space should end the more prompt.
feed('G') feed('G')
screen:expect([[ screen:expect([[
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{2: 99 }99 | {8: 99 }99 |
{2:100 }100 | {8:100 }100 |
{1:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('f') feed('f')
screen:expect_unchanged() screen:expect_unchanged()
@@ -344,34 +340,34 @@ describe('messages', function()
-- Pressing g< shows the previous command output. -- Pressing g< shows the previous command output.
feed('g<lt>') feed('g<lt>')
screen:expect([[ screen:expect([[
{2: 96 }96 | {8: 96 }96 |
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{2: 99 }99 | {8: 99 }99 |
{2:100 }100 | {8:100 }100 |
{1:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
-- A command line that doesn't print text is appended to scrollback, -- A command line that doesn't print text is appended to scrollback,
-- even if it invokes a nested command line. -- even if it invokes a nested command line.
feed([[:<C-R>=':'<CR>:<CR>g<lt>]]) feed([[:<C-R>=':'<CR>:<CR>g<lt>]])
screen:expect([[ screen:expect([[
{2: 97 }97 | {8: 97 }97 |
{2: 98 }98 | {8: 98 }98 |
{2: 99 }99 | {8: 99 }99 |
{2:100 }100 | {8:100 }100 |
::: | ::: |
{1:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed(':%p#\n') feed(':%p#\n')
screen:expect([[ screen:expect([[
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
-- Stop command output with q, <Esc> or CTRL-C. -- Stop command output with q, <Esc> or CTRL-C.
@@ -388,30 +384,30 @@ describe('messages', function()
-- Execute a : command from the more prompt -- Execute a : command from the more prompt
feed(':%p#\n') feed(':%p#\n')
screen:expect([[ screen:expect([[
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
{1:-- More --}^ | {6:-- More --}^ |
]]) ]])
feed(':') feed(':')
screen:expect([[ screen:expect([[
{2: 1 }1 | {8: 1 }1 |
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
:^ | :^ |
]]) ]])
feed("echo 'Hello'\n") feed("echo 'Hello'\n")
screen:expect([[ screen:expect([[
{2: 2 }2 | {8: 2 }2 |
{2: 3 }3 | {8: 3 }3 |
{2: 4 }4 | {8: 4 }4 |
{2: 5 }5 | {8: 5 }5 |
Hello | Hello |
{1:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
end) end)

View File

@@ -12,11 +12,9 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_colors() -- oldtest: Test_relativenumber_colors()
it('LineNr, LineNrAbove and LineNrBelow', function() it('LineNr, LineNrAbove and LineNrBelow', function()
local screen = Screen.new(50, 10) local screen = Screen.new(50, 10)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { foreground = Screen.colors.Red }, [100] = { foreground = Screen.colors.WebGreen },
[2] = { foreground = Screen.colors.Blue }, }
[3] = { foreground = Screen.colors.Green },
})
exec([[ exec([[
call setline(1, range(200)) call setline(1, range(200))
111 111
@@ -24,54 +22,54 @@ describe("'number' and 'relativenumber'", function()
hi LineNr guifg=red hi LineNr guifg=red
]]) ]])
screen:expect([[ screen:expect([[
{1: 4 }106 | {19: 4 }106 |
{1: 3 }107 | {19: 3 }107 |
{1: 2 }108 | {19: 2 }108 |
{1: 1 }109 | {19: 1 }109 |
{1:111 }^110 | {19:111 }^110 |
{1: 1 }111 | {19: 1 }111 |
{1: 2 }112 | {19: 2 }112 |
{1: 3 }113 | {19: 3 }113 |
{1: 4 }114 | {19: 4 }114 |
| |
]]) ]])
command('hi LineNrAbove guifg=blue') command('hi LineNrAbove guifg=blue')
screen:expect([[ screen:expect([[
{2: 4 }106 | {18: 4 }106 |
{2: 3 }107 | {18: 3 }107 |
{2: 2 }108 | {18: 2 }108 |
{2: 1 }109 | {18: 1 }109 |
{1:111 }^110 | {19:111 }^110 |
{1: 1 }111 | {19: 1 }111 |
{1: 2 }112 | {19: 2 }112 |
{1: 3 }113 | {19: 3 }113 |
{1: 4 }114 | {19: 4 }114 |
| |
]]) ]])
command('hi LineNrBelow guifg=green') command('hi LineNrBelow guifg=green')
screen:expect([[ screen:expect([[
{2: 4 }106 | {18: 4 }106 |
{2: 3 }107 | {18: 3 }107 |
{2: 2 }108 | {18: 2 }108 |
{2: 1 }109 | {18: 1 }109 |
{1:111 }^110 | {19:111 }^110 |
{3: 1 }111 | {100: 1 }111 |
{3: 2 }112 | {100: 2 }112 |
{3: 3 }113 | {100: 3 }113 |
{3: 4 }114 | {100: 4 }114 |
| |
]]) ]])
command('hi clear LineNrAbove') command('hi clear LineNrAbove')
screen:expect([[ screen:expect([[
{1: 4 }106 | {19: 4 }106 |
{1: 3 }107 | {19: 3 }107 |
{1: 2 }108 | {19: 2 }108 |
{1: 1 }109 | {19: 1 }109 |
{1:111 }^110 | {19:111 }^110 |
{3: 1 }111 | {100: 1 }111 |
{3: 2 }112 | {100: 2 }112 |
{3: 3 }113 | {100: 3 }113 |
{3: 4 }114 | {100: 4 }114 |
| |
]]) ]])
end) end)
@@ -79,12 +77,11 @@ describe("'number' and 'relativenumber'", function()
-- oldtest: Test_relativenumber_colors_wrapped() -- oldtest: Test_relativenumber_colors_wrapped()
it('LineNr, LineNrAbove and LineNrBelow with wrapped lines', function() it('LineNr, LineNrAbove and LineNrBelow with wrapped lines', function()
local screen = Screen.new(50, 20) local screen = Screen.new(50, 20)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { background = Screen.colors.Red, foreground = Screen.colors.Black }, [100] = { foreground = Screen.colors.Gray0, background = Screen.colors.Red },
[2] = { background = Screen.colors.Blue, foreground = Screen.colors.Black }, [101] = { foreground = Screen.colors.Gray0, background = Screen.colors.Blue1 },
[3] = { background = Screen.colors.Green, foreground = Screen.colors.Black }, [102] = { foreground = Screen.colors.Gray0, background = Screen.colors.WebGreen },
[4] = { bold = true, foreground = Screen.colors.Blue }, }
})
exec([[ exec([[
set display=lastline scrolloff=0 set display=lastline scrolloff=0
call setline(1, range(200)->map('v:val->string()->repeat(40)')) 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 hi LineNrBelow guibg=green guifg=black
]]) ]])
screen:expect([[ screen:expect([[
{2: 2 }1081081081081081081081081081081081081081081081| {101: 2 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810| {101: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 | {101: }8108108108108108108108108108 |
{2: 1 }1091091091091091091091091091091091091091091091| {101: 1 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910| {101: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 | {101: }9109109109109109109109109109 |
{1:111 }^1101101101101101101101101101101101101101101101| {100:111 }^1101101101101101101101101101101101101101101101|
{1: }1011011011011011011011011011011011011011011011| {100: }1011011011011011011011011011011011011011011011|
{1: }0110110110110110110110110110 | {100: }0110110110110110110110110110 |
{3: 1 }1111111111111111111111111111111111111111111111| {102: 1 }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111111111111111111111| {102: }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111 | {102: }1111111111111111111111111111 |
{3: 2 }1121121121121121121121121121121121121121121121| {102: 2 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211| {102: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 | {102: }2112112112112112112112112112 |
{3: 3 }1131131131131131131131131131131131131131131131| {102: 3 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311| {102: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 | {102: }3113113113113113113113113113 |
{3: 4 }1141141141141141141141141141141141141141141{4:@@@}| {102: 4 }1141141141141141141141141141141141141141141{1:@@@}|
| |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
{2: 1 }1081081081081081081081081081081081081081081081| {101: 1 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810| {101: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 | {101: }8108108108108108108108108108 |
{1:110 }^1091091091091091091091091091091091091091091091| {100:110 }^1091091091091091091091091091091091091091091091|
{1: }0910910910910910910910910910910910910910910910| {100: }0910910910910910910910910910910910910910910910|
{1: }9109109109109109109109109109 | {100: }9109109109109109109109109109 |
{3: 1 }1101101101101101101101101101101101101101101101| {102: 1 }1101101101101101101101101101101101101101101101|
{3: }1011011011011011011011011011011011011011011011| {102: }1011011011011011011011011011011011011011011011|
{3: }0110110110110110110110110110 | {102: }0110110110110110110110110110 |
{3: 2 }1111111111111111111111111111111111111111111111| {102: 2 }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111111111111111111111| {102: }1111111111111111111111111111111111111111111111|
{3: }1111111111111111111111111111 | {102: }1111111111111111111111111111 |
{3: 3 }1121121121121121121121121121121121121121121121| {102: 3 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211| {102: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 | {102: }2112112112112112112112112112 |
{3: 4 }1131131131131131131131131131131131131131131131| {102: 4 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311| {102: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 | {102: }3113113113113113113113113113 |
{3: 5 }1141141141141141141141141141141141141141141{4:@@@}| {102: 5 }1141141141141141141141141141141141141141141{1:@@@}|
| |
]]) ]])
feed('2j') feed('2j')
screen:expect([[ screen:expect([[
{2: 3 }1081081081081081081081081081081081081081081081| {101: 3 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810| {101: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 | {101: }8108108108108108108108108108 |
{2: 2 }1091091091091091091091091091091091091091091091| {101: 2 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910| {101: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 | {101: }9109109109109109109109109109 |
{2: 1 }1101101101101101101101101101101101101101101101| {101: 1 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011| {101: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 | {101: }0110110110110110110110110110 |
{1:112 }^1111111111111111111111111111111111111111111111| {100:112 }^1111111111111111111111111111111111111111111111|
{1: }1111111111111111111111111111111111111111111111| {100: }1111111111111111111111111111111111111111111111|
{1: }1111111111111111111111111111 | {100: }1111111111111111111111111111 |
{3: 1 }1121121121121121121121121121121121121121121121| {102: 1 }1121121121121121121121121121121121121121121121|
{3: }1211211211211211211211211211211211211211211211| {102: }1211211211211211211211211211211211211211211211|
{3: }2112112112112112112112112112 | {102: }2112112112112112112112112112 |
{3: 2 }1131131131131131131131131131131131131131131131| {102: 2 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311| {102: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 | {102: }3113113113113113113113113113 |
{3: 3 }1141141141141141141141141141141141141141141{4:@@@}| {102: 3 }1141141141141141141141141141141141141141141{1:@@@}|
| |
]]) ]])
feed('2j') feed('2j')
screen:expect([[ screen:expect([[
{2: 5 }1081081081081081081081081081081081081081081081| {101: 5 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810| {101: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 | {101: }8108108108108108108108108108 |
{2: 4 }1091091091091091091091091091091091091091091091| {101: 4 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910| {101: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 | {101: }9109109109109109109109109109 |
{2: 3 }1101101101101101101101101101101101101101101101| {101: 3 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011| {101: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 | {101: }0110110110110110110110110110 |
{2: 2 }1111111111111111111111111111111111111111111111| {101: 2 }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111111111111111111111| {101: }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111 | {101: }1111111111111111111111111111 |
{2: 1 }1121121121121121121121121121121121121121121121| {101: 1 }1121121121121121121121121121121121121121121121|
{2: }1211211211211211211211211211211211211211211211| {101: }1211211211211211211211211211211211211211211211|
{2: }2112112112112112112112112112 | {101: }2112112112112112112112112112 |
{1:114 }^1131131131131131131131131131131131131131131131| {100:114 }^1131131131131131131131131131131131131131131131|
{1: }1311311311311311311311311311311311311311311311| {100: }1311311311311311311311311311311311311311311311|
{1: }3113113113113113113113113113 | {100: }3113113113113113113113113113 |
{3: 1 }1141141141141141141141141141141141141141141{4:@@@}| {102: 1 }1141141141141141141141141141141141141141141{1:@@@}|
| |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
{2: 4 }1081081081081081081081081081081081081081081081| {101: 4 }1081081081081081081081081081081081081081081081|
{2: }0810810810810810810810810810810810810810810810| {101: }0810810810810810810810810810810810810810810810|
{2: }8108108108108108108108108108 | {101: }8108108108108108108108108108 |
{2: 3 }1091091091091091091091091091091091091091091091| {101: 3 }1091091091091091091091091091091091091091091091|
{2: }0910910910910910910910910910910910910910910910| {101: }0910910910910910910910910910910910910910910910|
{2: }9109109109109109109109109109 | {101: }9109109109109109109109109109 |
{2: 2 }1101101101101101101101101101101101101101101101| {101: 2 }1101101101101101101101101101101101101101101101|
{2: }1011011011011011011011011011011011011011011011| {101: }1011011011011011011011011011011011011011011011|
{2: }0110110110110110110110110110 | {101: }0110110110110110110110110110 |
{2: 1 }1111111111111111111111111111111111111111111111| {101: 1 }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111111111111111111111| {101: }1111111111111111111111111111111111111111111111|
{2: }1111111111111111111111111111 | {101: }1111111111111111111111111111 |
{1:113 }^1121121121121121121121121121121121121121121121| {100:113 }^1121121121121121121121121121121121121121121121|
{1: }1211211211211211211211211211211211211211211211| {100: }1211211211211211211211211211211211211211211211|
{1: }2112112112112112112112112112 | {100: }2112112112112112112112112112 |
{3: 1 }1131131131131131131131131131131131131131131131| {102: 1 }1131131131131131131131131131131131131131131131|
{3: }1311311311311311311311311311311311311311311311| {102: }1311311311311311311311311311311311311311311311|
{3: }3113113113113113113113113113 | {102: }3113113113113113113113113113 |
{3: 2 }1141141141141141141141141141141141141141141{4:@@@}| {102: 2 }1141141141141141141141141141141141141141141{1:@@@}|
| |
]]) ]])
end) end)

View File

@@ -1202,14 +1202,9 @@ describe('smoothscroll', function()
it('<<< marker shows with tabline, winbar and splits', function() it('<<< marker shows with tabline, winbar and splits', function()
screen:try_resize(40, 12) screen:try_resize(40, 12)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { foreground = Screen.colors.Blue1, bold = true }, [100] = { foreground = Screen.colors.Magenta1, bold = true },
[2] = { reverse = true }, }
[3] = { bold = true, reverse = true },
[4] = { background = Screen.colors.LightMagenta },
[5] = { bold = true },
[31] = { foreground = Screen.colors.Fuchsia, bold = true },
})
exec([[ exec([[
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7)) call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
set smoothscroll scrolloff=0 set smoothscroll scrolloff=0
@@ -1232,7 +1227,7 @@ describe('smoothscroll', function()
exec('set showtabline=2') exec('set showtabline=2')
feed('<C-E>') feed('<C-E>')
screen:expect([[ 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 | {1:<<<}e text with some text with some text |
with some text with some text | with some text with some text |
Line with some text with some text with | Line with some text with some text with |
@@ -1248,7 +1243,7 @@ describe('smoothscroll', function()
exec('set winbar=winbar') exec('set winbar=winbar')
feed('<C-w>k<C-E>') feed('<C-w>k<C-E>')
screen:expect([[ screen:expect([[
{5: }{31:2}{5:+ [No Name] }{2: }| {5: }{100:2}{5:+ [No Name] }{2: }|
{5:winbar }| {5:winbar }|
{1:<<<}e text with some text with some text | {1:<<<}e text with some text with some text |
^with some text with some text | ^with some text with some text |

View File

@@ -18,13 +18,6 @@ describe('search cmdline', function()
clear() clear()
command('set nohlsearch inccommand=') command('set nohlsearch inccommand=')
screen = Screen.new(20, 3) 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) end)
local function tenlines() local function tenlines()
@@ -60,57 +53,57 @@ describe('search cmdline', function()
feed('/the') feed('/the')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 {inc:the} | 3 {2:the} |
/the^ | /the^ |
]]) ]])
eq({ 0, 0, 0, 0 }, fn.getpos('"')) eq({ 0, 0, 0, 0 }, fn.getpos('"'))
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
3 the | 3 the |
4 {inc:the}ir | 4 {2:the}ir |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
4 their | 4 their |
5 {inc:the}re | 5 {2:the}re |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
5 there | 5 there |
6 {inc:the}ir | 6 {2:the}ir |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
6 their | 6 their |
7 {inc:the} | 7 {2:the} |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
7 the | 7 the |
8 {inc:the}m | 8 {2:the}m |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
8 them | 8 them |
9 {inc:the}se | 9 {2:the}se |
/the^ | /the^ |
]]) ]])
screen.bell = false screen.bell = false
feed('<C-G>') feed('<C-G>')
if wrapscan == 'wrapscan' then if wrapscan == 'wrapscan' then
screen:expect([[ screen:expect([[
2 {inc:the}se | 2 {2:the}se |
3 the | 3 the |
/the^ | /the^ |
]]) ]])
@@ -118,7 +111,7 @@ describe('search cmdline', function()
screen:expect { screen:expect {
grid = [[ grid = [[
8 them | 8 them |
9 {inc:the}se | 9 {2:the}se |
/the^ | /the^ |
]], ]],
condition = function() condition = function()
@@ -136,7 +129,7 @@ describe('search cmdline', function()
feed('?the') feed('?the')
screen:expect([[ screen:expect([[
9 {inc:the}se | 9 {2:the}se |
10 foobar | 10 foobar |
?the^ | ?the^ |
]]) ]])
@@ -144,7 +137,7 @@ describe('search cmdline', function()
if wrapscan == 'wrapscan' then if wrapscan == 'wrapscan' then
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 {inc:the}se | 2 {2:the}se |
3 the | 3 the |
?the^ | ?the^ |
]]) ]])
@@ -158,7 +151,7 @@ describe('search cmdline', function()
feed('<C-G>') feed('<C-G>')
screen:expect { screen:expect {
grid = [[ grid = [[
9 {inc:the}se | 9 {2:the}se |
10 foobar | 10 foobar |
?the^ | ?the^ |
]], ]],
@@ -176,13 +169,13 @@ describe('search cmdline', function()
command('$') command('$')
feed('?the') feed('?the')
screen:expect([[ screen:expect([[
9 {inc:the}se | 9 {2:the}se |
10 foobar | 10 foobar |
?the^ | ?the^ |
]]) ]])
feed('<C-T>') feed('<C-T>')
screen:expect([[ screen:expect([[
8 {inc:the}m | 8 {2:the}m |
9 these | 9 these |
?the^ | ?the^ |
]]) ]])
@@ -195,7 +188,7 @@ describe('search cmdline', function()
end end
end end
screen:expect([[ screen:expect([[
2 {inc:the}se | 2 {2:the}se |
3 the | 3 the |
?the^ | ?the^ |
]]) ]])
@@ -203,14 +196,14 @@ describe('search cmdline', function()
feed('<C-T>') feed('<C-T>')
if wrapscan == 'wrapscan' then if wrapscan == 'wrapscan' then
screen:expect([[ screen:expect([[
9 {inc:the}se | 9 {2:the}se |
10 foobar | 10 foobar |
?the^ | ?the^ |
]]) ]])
else else
screen:expect { screen:expect {
grid = [[ grid = [[
2 {inc:the}se | 2 {2:the}se |
3 the | 3 the |
?the^ | ?the^ |
]], ]],
@@ -245,24 +238,24 @@ describe('search cmdline', function()
feed('/the') feed('/the')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
feed('<C-L>') feed('<C-L>')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:thes}e | 2 {2:thes}e |
/thes^ | /thes^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
9 {inc:thes}e | 9 {2:thes}e |
10 foobar | 10 foobar |
/thes^ | /thes^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 {inc:thes}e | 2 {2:thes}e |
3 the | 3 the |
/thes^ | /thes^ |
]]) ]])
@@ -278,18 +271,18 @@ describe('search cmdline', function()
feed('/the') feed('/the')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
feed('<C-L>') feed('<C-L>')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:thes}e | 2 {2:thes}e |
/thes^ | /thes^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
9 {inc:thes}e | 9 {2:thes}e |
10 foobar | 10 foobar |
/thes^ | /thes^ |
]]) ]])
@@ -309,41 +302,41 @@ describe('search cmdline', function()
feed('/thei') feed('/thei')
screen:expect([[ screen:expect([[
3 the | 3 the |
4 {inc:thei}r | 4 {2:thei}r |
/thei^ | /thei^ |
]]) ]])
-- Match from initial cursor position when modifying search -- Match from initial cursor position when modifying search
feed('<BS>') feed('<BS>')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
-- New text advances to next match -- New text advances to next match
feed('s') feed('s')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:thes}e | 2 {2:thes}e |
/thes^ | /thes^ |
]]) ]])
-- Stay on this match when deleting a character -- Stay on this match when deleting a character
feed('<BS>') feed('<BS>')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
-- Advance to previous match -- Advance to previous match
feed('<C-T>') feed('<C-T>')
screen:expect([[ screen:expect([[
9 {inc:the}se | 9 {2:the}se |
10 foobar | 10 foobar |
/the^ | /the^ |
]]) ]])
-- Extend search to include next character -- Extend search to include next character
feed('<C-L>') feed('<C-L>')
screen:expect([[ screen:expect([[
9 {inc:thes}e | 9 {2:thes}e |
10 foobar | 10 foobar |
/thes^ | /thes^ |
]]) ]])
@@ -357,13 +350,13 @@ describe('search cmdline', function()
feed('the') feed('the')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
feed('\\>') feed('\\>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 {inc:the} | 3 {2:the} |
/the\>^ | /the\>^ |
]]) ]])
end) end)
@@ -377,7 +370,7 @@ describe('search cmdline', function()
feed('/the') feed('/the')
screen:expect([[ screen:expect([[
1 | 1 |
2 {inc:the}se | 2 {2:the}se |
/the^ | /the^ |
]]) ]])
@@ -385,7 +378,7 @@ describe('search cmdline', function()
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 {inc:the} theother | 3 {2:the} theother |
/the^ | /the^ |
]]) ]])
@@ -393,13 +386,13 @@ describe('search cmdline', function()
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 the {inc:the}other | 3 the {2:the}other |
/the^ | /the^ |
]]) ]])
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 the theo{inc:the}r | 3 the theo{2:the}r |
/the^ | /the^ |
]]) ]])
@@ -407,20 +400,20 @@ describe('search cmdline', function()
feed('<C-T>') feed('<C-T>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 the {inc:the}other | 3 the {2:the}other |
/the^ | /the^ |
]]) ]])
feed('<C-T>') feed('<C-T>')
screen:expect([[ screen:expect([[
2 these | 2 these |
3 {inc:the} theother | 3 {2:the} theother |
/the^ | /the^ |
]]) ]])
-- Previous match, different line -- Previous match, different line
feed('<C-T>') feed('<C-T>')
screen:expect([[ screen:expect([[
2 {inc:the}se | 2 {2:the}se |
3 the theother | 3 the theother |
/the^ | /the^ |
]]) ]])
@@ -436,7 +429,7 @@ describe('search cmdline', function()
7 the | 7 the |
8 them | 8 them |
9 these | 9 these |
10 {inc:foo}bar | 10 {2:foo}bar |
/foo^ | /foo^ |
]]) ]])
feed('<BS>') feed('<BS>')
@@ -445,7 +438,7 @@ describe('search cmdline', function()
7 the | 7 the |
8 them | 8 them |
9 these | 9 these |
10 {inc:fo}obar | 10 {2:fo}obar |
/fo^ | /fo^ |
]]) ]])
feed('<CR>') feed('<CR>')
@@ -476,7 +469,7 @@ describe('search cmdline', function()
feed('/foo') feed('/foo')
screen:expect([[ screen:expect([[
9 these | 9 these |
10 {inc:foo}bar | 10 {2:foo}bar |
/foo^ | /foo^ |
]]) ]])
feed('<C-W>') feed('<C-W>')
@@ -488,8 +481,8 @@ describe('search cmdline', function()
feed('<CR>') feed('<CR>')
screen:expect([[ screen:expect([[
/ | / |
{err:E35: No previous regular expression} | {9:E35: No previous regular expression} |
{more:Press ENTER or type command to continue}^ | {6:Press ENTER or type command to continue}^ |
]]) ]])
feed('<CR>') feed('<CR>')
eq({ eq({
@@ -613,9 +606,9 @@ describe('search cmdline', function()
feed(':sort ni u /on') feed(':sort ni u /on')
screen:expect([[ screen:expect([[
another {inc:on}e 2 | another {2:on}e 2 |
that {hl:on}e 3 | that {10:on}e 3 |
the {hl:on}e 1 | the {10:on}e 1 |
:sort ni u /on^ | :sort ni u /on^ |
]]) ]])
feed('<esc>') feed('<esc>')
@@ -629,27 +622,27 @@ describe('search cmdline', function()
feed(':vimgrep on') feed(':vimgrep on')
screen:expect([[ screen:expect([[
another {inc:on}e 2 | another {2:on}e 2 |
that {hl:on}e 3 | that {10:on}e 3 |
the {hl:on}e 1 | the {10:on}e 1 |
:vimgrep on^ | :vimgrep on^ |
]]) ]])
feed('<esc>') feed('<esc>')
feed(':vimg /on/ *.txt') feed(':vimg /on/ *.txt')
screen:expect([[ screen:expect([[
another {inc:on}e 2 | another {2:on}e 2 |
that {hl:on}e 3 | that {10:on}e 3 |
the {hl:on}e 1 | the {10:on}e 1 |
:vimg /on/ *.txt^ | :vimg /on/ *.txt^ |
]]) ]])
feed('<esc>') feed('<esc>')
feed(':vimgrepadd "\\<LT>on') feed(':vimgrepadd "\\<LT>on')
screen:expect([[ screen:expect([[
another {inc:on}e 2 | another {2:on}e 2 |
that {hl:on}e 3 | that {10:on}e 3 |
the {hl:on}e 1 | the {10:on}e 1 |
:vimgrepadd "\<on^ | :vimgrepadd "\<on^ |
]]) ]])
feed('<esc>') feed('<esc>')
@@ -657,7 +650,7 @@ describe('search cmdline', function()
feed(':lv "tha') feed(':lv "tha')
screen:expect([[ screen:expect([[
another one 2 | another one 2 |
{inc:tha}t one 3 | {2:tha}t one 3 |
the one 1 | the one 1 |
:lv "tha^ | :lv "tha^ |
]]) ]])
@@ -665,9 +658,9 @@ describe('search cmdline', function()
feed(':lvimgrepa "the" **/*.txt') feed(':lvimgrepa "the" **/*.txt')
screen:expect([[ screen:expect([[
ano{inc:the}r one 2 | ano{2:the}r one 2 |
that one 3 | that one 3 |
{hl:the} one 1 | {10:the} one 1 |
:lvimgrepa "the" **/*.txt^ | :lvimgrepa "the" **/*.txt^ |
]]) ]])
feed('<esc>') feed('<esc>')
@@ -718,7 +711,7 @@ describe('search cmdline', function()
call feedkeys("2\<C-E>", 't') call feedkeys("2\<C-E>", 't')
]]) ]])
local s = [[ local s = [[
{tilde:<<<} 18 19 20 21 22 2| {1:<<<} 18 19 20 21 22 2|
^3 24 | ^3 24 |
|*4 |*4
]] ]]
@@ -726,13 +719,13 @@ describe('search cmdline', function()
feed('/xx') feed('/xx')
screen:expect([[ screen:expect([[
|*4 |*4
{inc:xx}x | {2:xx}x |
/xx^ | /xx^ |
]]) ]])
feed('x') feed('x')
screen:expect([[ screen:expect([[
|*4 |*4
{inc:xxx} | {2:xxx} |
/xxx^ | /xxx^ |
]]) ]])
feed('<Esc>') feed('<Esc>')
@@ -764,13 +757,14 @@ describe('Search highlight', function()
-- oldtest: Test_hlsearch_and_visual() -- oldtest: Test_hlsearch_and_visual()
it('is combined with Visual highlight vim-patch:8.2.2797', function() it('is combined with Visual highlight vim-patch:8.2.2797', function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:set_default_attr_ids({ screen:add_extra_attr_ids {
[1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText [100] = {
[2] = { bold = true }, -- ModeMsg, Search foreground = Screen.colors.Black,
[3] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black }, -- Visual bold = true,
[4] = { background = Screen.colors.Yellow, bold = true }, -- Search background = Screen.colors.LightGrey,
[5] = { background = Screen.colors.LightGrey, bold = true, foreground = Screen.colors.Black }, },
}) [101] = { bold = true, background = Screen.colors.Yellow },
}
exec([[ exec([[
set hlsearch noincsearch set hlsearch noincsearch
call setline(1, repeat(["xxx yyy zzz"], 3)) call setline(1, repeat(["xxx yyy zzz"], 3))
@@ -780,11 +774,11 @@ describe('Search highlight', function()
]]) ]])
feed('vjj') feed('vjj')
screen:expect([[ screen:expect([[
xxx {4:y}{5:yy}{3: zzz} | xxx {101:y}{100:yy}{17: zzz} |
{3:xxx }{5:yyy}{3: zzz} | {17:xxx }{100:yyy}{17: zzz} |
{3:xxx }{5:y}{4:^yy} zzz | {17:xxx }{100:y}{101:^yy} zzz |
{1:~ }|*2 {1:~ }|*2
{2:-- VISUAL --} | {5:-- VISUAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -8,13 +8,6 @@ describe('search stat', function()
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(30, 10) 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) end)
-- oldtest: Test_search_stat_screendump() -- oldtest: Test_search_stat_screendump()
@@ -32,7 +25,7 @@ describe('search stat', function()
]]) ]])
screen:expect([[ screen:expect([[
foobar | foobar |
{2:^find this} | {10:^find this} |
fooooobar | fooooobar |
foba | foba |
foobar |*2 foobar |*2
@@ -45,7 +38,7 @@ describe('search stat', function()
feed('gg0n') feed('gg0n')
screen:expect([[ screen:expect([[
foobar | foobar |
{2:^find this} | {10:^find this} |
fooooobar | fooooobar |
foba | foba |
foobar |*2 foobar |*2
@@ -68,7 +61,7 @@ describe('search stat', function()
]]) ]])
screen:expect([[ screen:expect([[
if | if |
{3:^+-- 2 lines: foo·············}| {13:^+-- 2 lines: foo·············}|
endif | endif |
| |
{1:~ }|*5 {1:~ }|*5
@@ -91,16 +84,16 @@ describe('search stat', function()
feed('/dog<CR>') feed('/dog<CR>')
screen:expect([[ screen:expect([[
int cat; | int cat; |
int {2:^dog}; | int {10:^dog}; |
cat = {2:dog}; | cat = {10:dog}; |
{1:~ }|*6 {1:~ }|*6
/dog [1/2] | /dog [1/2] |
]]) ]])
feed('G0gD') feed('G0gD')
screen:expect([[ screen:expect([[
int {2:^cat}; | int {10:^cat}; |
int dog; | int dog; |
{2:cat} = dog; | {10:cat} = dog; |
{1:~ }|*6 {1:~ }|*6
| |
]]) ]])
@@ -128,9 +121,19 @@ describe('search stat', function()
feed('/abc') feed('/abc')
screen:expect([[ screen:expect([[
{4: }| {2: }|
{2:abc}--c | {10:abc}--c |
--------{4:abc} | --------{2:abc} |
--{10:abc} |
{1:~ }|*5
/abc^ |
]])
feed('<C-G>')
screen:expect([[
{2:3/3 }|
{10:abc}--c |
--------{10:abc} |
--{2:abc} | --{2:abc} |
{1:~ }|*5 {1:~ }|*5
/abc^ | /abc^ |
@@ -138,20 +141,10 @@ describe('search stat', function()
feed('<C-G>') feed('<C-G>')
screen:expect([[ screen:expect([[
{4:3/3 }| {2:1/3 }|
{2:abc}--c | {2:abc}--c |
--------{2:abc} | --------{10:abc} |
--{4:abc} | --{10:abc} |
{1:~ }|*5
/abc^ |
]])
feed('<C-G>')
screen:expect([[
{4:1/3 }|
{4:abc}--c |
--------{2:abc} |
--{2:abc} |
{1:~ }|*5 {1:~ }|*5
/abc^ | /abc^ |
]]) ]])
@@ -167,7 +160,7 @@ describe('search stat', function()
feed('*') feed('*')
screen:expect([[ screen:expect([[
{2:^test} | {10:^test} |
| |
{1:~ }|*7 {1:~ }|*7
/\<test\> [1/1] | /\<test\> [1/1] |
@@ -175,7 +168,7 @@ describe('search stat', function()
feed('N') feed('N')
screen:expect([[ screen:expect([[
{2:^test} | {10:^test} |
| |
{1:~ }|*7 {1:~ }|*7
?\<test\> [1/1] | ?\<test\> [1/1] |
@@ -185,10 +178,10 @@ describe('search stat', function()
feed('N') feed('N')
-- shows "Search Hit Bottom.." -- shows "Search Hit Bottom.."
screen:expect([[ screen:expect([[
{2:^test} | {10:^test} |
| |
{1:~ }|*7 {1:~ }|*7
{5:search hit TOP, continuing at BOTTOM} | {19:search hit TOP, continuing at BOTTOM} |
]]) ]])
end) end)
end) end)