Merge pull request #5197 from bfredl/screenfix

cleanup of screen tests: remove unnecessary hl_group and ignores of highlights
This commit is contained in:
Björn Linse
2016-08-14 22:57:37 +02:00
committed by GitHub
27 changed files with 1435 additions and 1444 deletions

View File

@@ -213,22 +213,22 @@ describe('vim_* functions', function()
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.White, background = Screen.colors.Red}, [1] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[2] = {bold = true, foreground = Screen.colors.SeaGreen} [2] = {bold = true, foreground = Screen.colors.SeaGreen}
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
end) end)
it('can show one line', function() it('can show one line', function()
nvim_async('err_write', 'has bork\n') nvim_async('err_write', 'has bork\n')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:has bork} | {1:has bork} |
]]) ]])
end) end)
@@ -236,11 +236,11 @@ describe('vim_* functions', function()
it('shows return prompt when more than &cmdheight lines', function() it('shows return prompt when more than &cmdheight lines', function()
nvim_async('err_write', 'something happened\nvery bad\n') nvim_async('err_write', 'something happened\nvery bad\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:something happened} | {1:something happened} |
{1:very bad} | {1:very bad} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |
@@ -250,9 +250,9 @@ describe('vim_* functions', function()
it('shows return prompt after all lines are shown', function() it('shows return prompt after all lines are shown', function()
nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n') nvim_async('err_write', 'FAILURE\nERROR\nEXCEPTION\nTRACEBACK\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:FAILURE} | {1:FAILURE} |
{1:ERROR} | {1:ERROR} |
{1:EXCEPTION} | {1:EXCEPTION} |
@@ -267,12 +267,12 @@ describe('vim_* functions', function()
nvim_async('err_write', 'fail\n') nvim_async('err_write', 'fail\n')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:very fail} | {1:very fail} |
]]) ]])
helpers.wait() helpers.wait()
@@ -280,11 +280,11 @@ describe('vim_* functions', function()
-- shows up to &cmdheight lines -- shows up to &cmdheight lines
nvim_async('err_write', 'more fail\ntoo fail\n') nvim_async('err_write', 'more fail\ntoo fail\n')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:more fail} | {1:more fail} |
{1:too fail} | {1:too fail} |
{2:Press ENTER or type command to continue}^ | {2:Press ENTER or type command to continue}^ |

View File

@@ -72,13 +72,13 @@ describe('execute()', function()
it('silences command run inside', function() it('silences command run inside', function()
local screen = Screen.new(20, 5) local screen = Screen.new(20, 5)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=255}}) screen:set_default_attr_ids( {[0] = {bold=true, foreground=255}} )
feed(':let g:mes = execute("echon 42")<CR>') feed(':let g:mes = execute("echon 42")<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
eq('42', eval('g:mes')) eq('42', eval('g:mes'))

View File

@@ -137,7 +137,7 @@ describe('timers', function()
it("doesn't mess up the cmdline", function() it("doesn't mess up the cmdline", function()
local screen = Screen.new(40, 6) local screen = Screen.new(40, 6)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}}) screen:set_default_attr_ids( {[0] = {bold=true, foreground=255}} )
source([[ source([[
func! MyHandler(timer) func! MyHandler(timer)
echo "evil" echo "evil"
@@ -148,10 +148,10 @@ describe('timers', function()
screen:sleep(200) screen:sleep(200)
screen:expect([[ screen:expect([[
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:good^ | :good^ |
]]) ]])
end) end)

View File

@@ -9,8 +9,8 @@ describe(":drop", function()
clear() clear()
screen = Screen.new(35, 10) screen = Screen.new(35, 10)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}})
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true, reverse = true}, [1] = {bold = true, reverse = true},
[2] = {reverse = true}, [2] = {reverse = true},
[3] = {bold = true}, [3] = {bold = true},
@@ -26,13 +26,13 @@ describe(":drop", function()
execute("drop tmp1.vim") execute("drop tmp1.vim")
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:tmp1.vim }| {1:tmp1.vim }|
"tmp1.vim" [New File] | "tmp1.vim" [New File] |
]]) ]])
@@ -45,13 +45,13 @@ describe(":drop", function()
execute("drop tmp1") execute("drop tmp1")
screen:expect([[ screen:expect([[
{2:|}^ | {2:|}^ |
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{2:tmp2 }{1:tmp1 }| {2:tmp2 }{1:tmp1 }|
:drop tmp1 | :drop tmp1 |
]]) ]])
@@ -65,13 +65,13 @@ describe(":drop", function()
execute("drop tmp3") execute("drop tmp3")
screen:expect([[ screen:expect([[
^ {2:|} | ^ {2:|} |
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{1:tmp3 }{2:|}~ | {1:tmp3 }{2:|}{0:~ }|
ABC {2:|}~ | ABC {2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
~ {2:|}~ | {0:~ }{2:|}{0:~ }|
{2:tmp2 [+] tmp1 }| {2:tmp2 [+] tmp1 }|
"tmp3" [New File] | "tmp3" [New File] |
]]) ]])

View File

@@ -248,14 +248,13 @@ describe('packadd', function()
screen = Screen.new(30, 5) screen = Screen.new(30, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = { [1] = {
foreground = Screen.colors.Black, foreground = Screen.colors.Black,
background = Screen.colors.Yellow, background = Screen.colors.Yellow,
}, },
[2] = {bold = true, reverse = true} [2] = {bold = true, reverse = true}
}) })
local NonText = Screen.colors.Blue
screen:set_default_attr_ignore({{}, {bold=true, foreground=NonText}})
execute([[let optdir1 = &packpath . '/pack/mine/opt']]) execute([[let optdir1 = &packpath . '/pack/mine/opt']])
execute([[let optdir2 = &packpath . '/pack/candidate/opt']]) execute([[let optdir2 = &packpath . '/pack/candidate/opt']])
@@ -269,32 +268,32 @@ describe('packadd', function()
feed(':packadd <Tab>') feed(':packadd <Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{1:pluginA}{2: pluginB pluginC }| {1:pluginA}{2: pluginB pluginC }|
:packadd pluginA^ | :packadd pluginA^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA }{1:pluginB}{2: pluginC }| {2:pluginA }{1:pluginB}{2: pluginC }|
:packadd pluginB^ | :packadd pluginB^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA pluginB }{1:pluginC}{2: }| {2:pluginA pluginB }{1:pluginC}{2: }|
:packadd pluginC^ | :packadd pluginC^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:pluginA pluginB pluginC }| {2:pluginA pluginB pluginC }|
:packadd ^ | :packadd ^ |
]=]) ]=])
@@ -316,32 +315,32 @@ describe('packadd', function()
feed(':colorscheme <Tab>') feed(':colorscheme <Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{1:one}{2: three two }| {1:one}{2: three two }|
:colorscheme one^ | :colorscheme one^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one }{1:three}{2: two }| {2:one }{1:three}{2: two }|
:colorscheme three^ | :colorscheme three^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one three }{1:two}{2: }| {2:one three }{1:two}{2: }|
:colorscheme two^ | :colorscheme two^ |
]=]) ]=])
feed('<Tab>') feed('<Tab>')
screen:expect([=[ screen:expect([=[
| |
~ | {0:~ }|
~ | {0:~ }|
{2:one three two }| {2:one three two }|
:colorscheme ^ | :colorscheme ^ |
]=]) ]=])

View File

@@ -16,7 +16,10 @@ describe('matchparen', function()
reset() reset()
screen = Screen.new(20,5) screen = Screen.new(20,5)
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {bold=true},
} )
end) end)
it('uses correct column after i_<Up>. Vim patch 7.4.1296', function() it('uses correct column after i_<Up>. Vim patch 7.4.1296', function()
@@ -37,7 +40,7 @@ describe('matchparen', function()
^ | ^ |
} | } |
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {bold = true}}) ]])
end) end)
end) end)

View File

@@ -21,7 +21,7 @@ describe('terminal altscreen', function()
line7 | line7 |
line8 | line8 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
enter_altscreen() enter_altscreen()
screen:expect([[ screen:expect([[
@@ -31,7 +31,7 @@ describe('terminal altscreen', function()
| |
| |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(10, curbuf('line_count')) eq(10, curbuf('line_count'))
end) end)
@@ -60,7 +60,7 @@ describe('terminal altscreen', function()
line7 | line7 |
line8 | line8 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
screen:expect([[ screen:expect([[
@@ -86,7 +86,7 @@ describe('terminal altscreen', function()
line15 | line15 |
line16 | line16 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -116,7 +116,7 @@ describe('terminal altscreen', function()
| |
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -149,7 +149,7 @@ describe('terminal altscreen', function()
line5 | line5 |
line6 | line6 |
line7 | line7 |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -21,11 +21,11 @@ describe('terminal buffer', function()
feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>') feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:enew | :enew |
]]) ]])
end) end)
@@ -34,11 +34,11 @@ describe('terminal buffer', function()
feed(':bnext:l<esc>') feed(':bnext:l<esc>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
| |
]]) ]])
end) end)
@@ -78,7 +78,7 @@ describe('terminal buffer', function()
| |
| |
^ | ^ |
E21: Cannot make changes, 'modifiable' is off | {8:E21: Cannot make changes, 'modifiable' is off} |
]]) ]])
end) end)
@@ -138,21 +138,21 @@ describe('terminal buffer', function()
feed('<c-\\><c-n>:bd!<cr>') feed('<c-\\><c-n>:bd!<cr>')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:bd! | :bd! |
]]) ]])
execute('bnext') execute('bnext')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
:bnext | :bnext |
]]) ]])
end) end)
@@ -180,8 +180,8 @@ describe('terminal buffer', function()
-- We should be in a new buffer now. -- We should be in a new buffer now.
screen:expect([[ screen:expect([[
ab^c | ab^c |
~ | {4:~ }|
========== | {5:========== }|
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
{1:========== }| {1:========== }|

View File

@@ -25,7 +25,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -49,12 +49,12 @@ describe('terminal cursor', function()
it('is positioned correctly when unfocused', function() it('is positioned correctly when unfocused', function()
screen:expect([[ screen:expect([[
1 tty ready | {7: 1 }tty ready |
2 {2: } | {7: 2 }{2: } |
3 | {7: 3 } |
4 | {7: 4 } |
5 | {7: 5 } |
6 ^ | {7: 6 }^ |
:set number | :set number |
]]) ]])
end) end)
@@ -83,7 +83,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
show_cursor() show_cursor()
screen:expect([[ screen:expect([[
@@ -93,7 +93,7 @@ describe('terminal cursor', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- same for when the terminal is unfocused -- same for when the terminal is unfocused
feed('<c-\\><c-n>') feed('<c-\\><c-n>')
@@ -132,14 +132,8 @@ describe('cursor with customized highlighting', function()
screen = Screen.new(50, 7) screen = Screen.new(50, 7)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = 45, background = 46}, [1] = {foreground = 45, background = 46},
[2] = {foreground = 55, background = 56} [2] = {foreground = 55, background = 56},
}) [3] = {bold = true},
screen:set_default_attr_ignore({
[1] = {bold = true},
[2] = {foreground = 12},
[3] = {bold = true, reverse = true},
[5] = {background = 11},
[6] = {foreground = 130},
}) })
screen:attach(false) screen:attach(false)
execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
@@ -153,7 +147,7 @@ describe('cursor with customized highlighting', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>') feed('<c-\\><c-n>')
screen:expect([[ screen:expect([[

View File

@@ -44,14 +44,13 @@ local function screen_setup(extra_height, command)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {reverse = true}, -- focused cursor [1] = {reverse = true}, -- focused cursor
[2] = {background = 11}, -- unfocused cursor [2] = {background = 11}, -- unfocused cursor
}) [3] = {bold = true},
screen:set_default_attr_ignore({ [4] = {foreground = 12},
[1] = {bold = true}, [5] = {bold = true, reverse = true},
[2] = {foreground = 12}, [6] = {background = 11},
[3] = {bold = true, reverse = true}, [7] = {foreground = 130},
[5] = {background = 11}, [8] = {foreground = 15, background = 1}, -- error message
[6] = {foreground = 130}, [9] = {foreground = 4},
[7] = {foreground = 15, background = 1}, -- error message
}) })
screen:attach(false) screen:attach(false)
@@ -76,7 +75,7 @@ local function screen_setup(extra_height, command)
table.insert(expected, empty_line) table.insert(expected, empty_line)
end end
table.insert(expected, '-- TERMINAL -- ') table.insert(expected, '{3:-- TERMINAL --} ')
screen:expect(table.concat(expected, '\n')) screen:expect(table.concat(expected, '\n'))
else else
wait() wait()

View File

@@ -16,33 +16,32 @@ describe('terminal window highlighting', function()
[1] = {foreground = 45}, [1] = {foreground = 45},
[2] = {background = 46}, [2] = {background = 46},
[3] = {foreground = 45, background = 46}, [3] = {foreground = 45, background = 46},
[4] = {bold = true, italic = true, underline = true} [4] = {bold = true, italic = true, underline = true},
}) [5] = {bold = true},
screen:set_default_attr_ignore({ [6] = {foreground = 12},
[1] = {bold = true}, [7] = {bold = true, reverse = true},
[2] = {foreground = 12},
[3] = {bold = true, reverse = true},
[5] = {background = 11},
[6] = {foreground = 130},
[7] = {reverse = true},
[8] = {background = 11}, [8] = {background = 11},
[9] = {foreground = 130},
[10] = {reverse = true},
[11] = {background = 11},
}) })
screen:attach(false) screen:attach(false)
execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{10: } |
| |
| |
| |
| |
| {5:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
local function descr(title, attr_num, set_attrs_fn) local function descr(title, attr_num, set_attrs_fn)
local function sub(s) local function sub(s)
return s:gsub('NUM', attr_num) local str = s:gsub('NUM', attr_num)
return str
end end
describe(title, function() describe(title, function()
@@ -54,16 +53,15 @@ describe('terminal window highlighting', function()
end) end)
local function pass_attrs() local function pass_attrs()
local s = sub([[ screen:expect(sub([[
tty ready | tty ready |
{NUM:text}text | {NUM:text}text{10: } |
| |
| |
| |
| |
-- TERMINAL -- | {5:-- TERMINAL --} |
]]) ]]))
screen:expect(s)
end end
it('will pass the corresponding attributes', pass_attrs) it('will pass the corresponding attributes', pass_attrs)
@@ -82,11 +80,11 @@ describe('terminal window highlighting', function()
line6 | line6 |
line7 | line7 |
line8 | line8 |
| {10: } |
-- TERMINAL -- | {5:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
local s = sub([[ screen:expect(sub([[
^tty ready | ^tty ready |
{NUM:text}textline1 | {NUM:text}textline1 |
line2 | line2 |
@@ -94,8 +92,7 @@ describe('terminal window highlighting', function()
line4 | line4 |
line5 | line5 |
| |
]]) ]]))
screen:expect(s)
end) end)
end) end)
end end
@@ -121,28 +118,26 @@ describe('terminal window highlighting with custom palette', function()
clear() clear()
screen = Screen.new(50, 7) screen = Screen.new(50, 7)
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = 1193046, special = Screen.colors.Black} [1] = {foreground = 1193046, special = Screen.colors.Black},
})
screen:set_default_attr_ignore({
[1] = {bold = true},
[2] = {foreground = 12}, [2] = {foreground = 12},
[3] = {bold = true, reverse = true}, [3] = {bold = true, reverse = true},
[5] = {background = 11}, [5] = {background = 11},
[6] = {foreground = 130}, [6] = {foreground = 130},
[7] = {reverse = true}, [7] = {reverse = true},
[8] = {background = 11}, [8] = {background = 11},
[9] = {bold = true},
}) })
screen:attach(true) screen:attach(true)
nvim('set_var', 'terminal_color_3', '#123456') nvim('set_var', 'terminal_color_3', '#123456')
execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{7: } |
| |
| |
| |
| |
| {9:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
@@ -153,12 +148,12 @@ describe('terminal window highlighting with custom palette', function()
thelpers.feed_data('text') thelpers.feed_data('text')
screen:expect([[ screen:expect([[
tty ready | tty ready |
{1:text}text | {1:text}text{7: } |
| |
| |
| |
| |
-- TERMINAL -- | {9:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -27,7 +27,7 @@ describe('terminal mouse', function()
line29 | line29 |
line30 | line30 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -74,7 +74,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -87,7 +87,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
"#{1: } | "#{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -100,7 +100,7 @@ describe('terminal mouse', function()
line30 | line30 |
mouse enabled | mouse enabled |
`!!{1: } | `!!{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -119,79 +119,79 @@ describe('terminal mouse', function()
]]) ]])
feed(':enew | set number<cr>') feed(':enew | set number<cr>')
screen:expect([[ screen:expect([[
1 ^ |line28 | {7: 1 }^ |line28 |
~ |line29 | {4:~ }|line29 |
~ |line30 | {4:~ }|line30 |
~ |rows: 5, cols: 25 | {4:~ }|rows: 5, cols: 25 |
~ |{2: } | {4:~ }|{2: } |
========== ========== | ========== ========== |
:enew | set number | :enew | set number |
]]) ]])
feed('30iline\n<esc>') feed('30iline\n<esc>')
screen:expect([[ screen:expect([[
27 line |line28 | {7: 27 }line |line28 |
28 line |line29 | {7: 28 }line |line29 |
29 line |line30 | {7: 29 }line |line30 |
30 line |rows: 5, cols: 25 | {7: 30 }line |rows: 5, cols: 25 |
31 ^ |{2: } | {7: 31 }^ |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])
feed('<c-w>li') feed('<c-w>li')
screen:expect([[ screen:expect([[
27 line |line29 | {7: 27 }line |line29 |
28 line |line30 | {7: 28 }line |line30 |
29 line |rows: 5, cols: 25 | {7: 29 }line |rows: 5, cols: 25 |
30 line |rows: 5, cols: 24 | {7: 30 }line |rows: 5, cols: 24 |
31 |{1: } | {7: 31 } |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- enabling mouse won't affect interaction with other windows -- enabling mouse won't affect interaction with other windows
thelpers.enable_mouse() thelpers.enable_mouse()
thelpers.feed_data('mouse enabled\n') thelpers.feed_data('mouse enabled\n')
screen:expect([[ screen:expect([[
27 line |line30 | {7: 27 }line |line30 |
28 line |rows: 5, cols: 25 | {7: 28 }line |rows: 5, cols: 25 |
29 line |rows: 5, cols: 24 | {7: 29 }line |rows: 5, cols: 24 |
30 line |mouse enabled | {7: 30 }line |mouse enabled |
31 |{1: } | {7: 31 } |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('wont lose focus if another window is scrolled', function() it('wont lose focus if another window is scrolled', function()
feed('<MouseDown><0,0><MouseDown><0,0>') feed('<MouseDown><0,0><MouseDown><0,0>')
screen:expect([[ screen:expect([[
21 line |line30 | {7: 21 }line |line30 |
22 line |rows: 5, cols: 25 | {7: 22 }line |rows: 5, cols: 25 |
23 line |rows: 5, cols: 24 | {7: 23 }line |rows: 5, cols: 24 |
24 line |mouse enabled | {7: 24 }line |mouse enabled |
25 line |{1: } | {7: 25 }line |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<S-MouseUp><0,0>') feed('<S-MouseUp><0,0>')
screen:expect([[ screen:expect([[
26 line |line30 | {7: 26 }line |line30 |
27 line |rows: 5, cols: 25 | {7: 27 }line |rows: 5, cols: 25 |
28 line |rows: 5, cols: 24 | {7: 28 }line |rows: 5, cols: 24 |
29 line |mouse enabled | {7: 29 }line |mouse enabled |
30 line |{1: } | {7: 30 }line |{1: } |
========== ========== | ========== ========== |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('will lose focus if another window is clicked', function() it('will lose focus if another window is clicked', function()
feed('<LeftMouse><5,1>') feed('<LeftMouse><5,1>')
screen:expect([[ screen:expect([[
27 line |line30 | {7: 27 }line |line30 |
28 l^ine |rows: 5, cols: 25 | {7: 28 }l^ine |rows: 5, cols: 25 |
29 line |rows: 5, cols: 24 | {7: 29 }line |rows: 5, cols: 24 |
30 line |mouse enabled | {7: 30 }line |mouse enabled |
31 |{2: } | {7: 31 } |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])

View File

@@ -33,7 +33,7 @@ describe('terminal scrollback', function()
line29 | line29 |
line30 | line30 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -61,7 +61,7 @@ describe('terminal scrollback', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -76,7 +76,7 @@ describe('terminal scrollback', function()
line4 | line4 |
line5 | line5 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(7, curbuf('line_count')) eq(7, curbuf('line_count'))
end) end)
@@ -92,7 +92,7 @@ describe('terminal scrollback', function()
line6 | line6 |
line7 | line7 |
line8{1: } | line8{1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('<c-\\><c-n>6k') feed('<c-\\><c-n>6k')
@@ -141,7 +141,7 @@ describe('terminal scrollback', function()
line4 | line4 |
rows: 5, cols: 50 | rows: 5, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -158,7 +158,7 @@ describe('terminal scrollback', function()
rows: 5, cols: 50 | rows: 5, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(8, curbuf('line_count')) eq(8, curbuf('line_count'))
feed('<c-\\><c-n>3k') feed('<c-\\><c-n>3k')
@@ -185,7 +185,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(4, curbuf('line_count')) eq(4, curbuf('line_count'))
end end
@@ -203,7 +203,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(4, curbuf('line_count')) eq(4, curbuf('line_count'))
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
@@ -218,7 +218,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -235,14 +235,14 @@ describe('terminal scrollback', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
screen:try_resize(screen._width, screen._height - 3) screen:try_resize(screen._width, screen._height - 3)
screen:expect([[ screen:expect([[
line4 | line4 |
rows: 3, cols: 50 | rows: 3, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(7, curbuf('line_count')) eq(7, curbuf('line_count'))
end) end)
@@ -255,7 +255,7 @@ describe('terminal scrollback', function()
rows: 3, cols: 50 | rows: 3, cols: 50 |
rows: 4, cols: 50 | rows: 4, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end end
@@ -277,7 +277,7 @@ describe('terminal scrollback', function()
rows: 4, cols: 50 | rows: 4, cols: 50 |
rows: 7, cols: 50 | rows: 7, cols: 50 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
eq(9, curbuf('line_count')) eq(9, curbuf('line_count'))
feed('<c-\\><c-n>gg') feed('<c-\\><c-n>gg')
@@ -315,7 +315,7 @@ describe('terminal scrollback', function()
rows: 11, cols: 50 | rows: 11, cols: 50 |
{1: } | {1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
-- since there's an empty line after the cursor, the buffer line -- since there's an empty line after the cursor, the buffer line
-- count equals the terminal screen height -- count equals the terminal screen height

View File

@@ -17,12 +17,12 @@ describe('tui', function()
screen.timeout = 60000 screen.timeout = 60000
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -36,20 +36,20 @@ describe('tui', function()
abc | abc |
test1 | test1 |
test2{1: } | test2{1: } |
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027') feed('\027')
screen:expect([[ screen:expect([[
abc | abc |
test1 | test1 |
test{1:2} | test{1:2} |
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -64,9 +64,9 @@ describe('tui', function()
alt-k | alt-k |
alt-l | alt-l |
{1: } | {1: } |
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('gg') feed('gg')
screen:expect([[ screen:expect([[
@@ -74,9 +74,9 @@ describe('tui', function()
alt-f | alt-f |
alt-g | alt-g |
alt-h | alt-h |
[No Name] [+] | {5:[No Name] [+] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -90,12 +90,12 @@ describe('tui', function()
feed('i\027j') feed('i\027j')
screen:expect([[ screen:expect([[
j{1: } | j{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -105,46 +105,46 @@ describe('tui', function()
feed('\022\022') -- ctrl+v feed('\022\022') -- ctrl+v
feed('\022\013') -- ctrl+m feed('\022\013') -- ctrl+m
screen:expect([[ screen:expect([[
{3:^G^V^M}{1: } | {9:^G^V^M}{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]], {[1] = {reverse = true}, [2] = {background = 11}, [3] = {foreground = 4}}) ]])
end) end)
it('automatically sends <Paste> for bracketed paste sequences', function() it('automatically sends <Paste> for bracketed paste sequences', function()
feed('i\027[200~') feed('i\027[200~')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
-- INSERT (paste) -- | {3:-- INSERT (paste) --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('pasted from terminal') feed('pasted from terminal')
screen:expect([[ screen:expect([[
pasted from terminal{1: } | pasted from terminal{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT (paste) -- | {3:-- INSERT (paste) --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[201~') feed('\027[201~')
screen:expect([[ screen:expect([[
pasted from terminal{1: } | pasted from terminal{1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] [+] | {5:[No Name] [+] }|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -160,9 +160,9 @@ describe('tui', function()
item 2998 | item 2998 |
item 2999 | item 2999 |
item 3000{1: } | item 3000{1: } |
[No Name] [+] 3000,10 Bot| {5:[No Name] [+] 3000,10 Bot}|
-- INSERT -- | {3:-- INSERT --} |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -176,17 +176,15 @@ describe('tui with non-tty file descriptors', function()
it('can handle pipes as stdout and stderr', function() it('can handle pipes as stdout and stderr', function()
local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"') local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog..' -u NONE -i NONE --cmd \'set noswapfile\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"')
screen:set_default_attr_ids({})
screen:set_default_attr_ignore(true)
feed(':w testF\n:q\n') feed(':w testF\n:q\n')
screen:expect([[ screen:expect([[
:w testF | :w testF |
:q | :q |
abc | abc |
| |
[Process exited 0] | [Process exited 0]{1: } |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -205,23 +203,23 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -231,22 +229,22 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -255,22 +253,22 @@ describe('tui focus event handling', function()
feed('\027[I') feed('\027[I')
screen:expect([[ screen:expect([[
| |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
g{1:a}ined | g{1:a}ined |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
| |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
l{1:o}st | l{1:o}st |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -287,7 +285,7 @@ describe('tui focus event handling', function()
| |
| |
gained | gained |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
feed('\027[O') feed('\027[O')
screen:expect([[ screen:expect([[
@@ -297,7 +295,7 @@ describe('tui focus event handling', function()
| |
| |
lost | lost |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -319,15 +317,21 @@ describe("tui 't_Co' (terminal colors)", function()
helpers.nvim_prog)) helpers.nvim_prog))
thelpers.feed_data(":echo &t_Co\n") thelpers.feed_data(":echo &t_Co\n")
local tline
if maxcolors == 8 then
tline = "~ "
else
tline = "{4:~ }"
end
screen:expect(string.format([[ screen:expect(string.format([[
{1: } | {1: } |
~ | %s|
~ | %s|
~ | %s|
[No Name] | {5:[No Name] }|
%-3s | %-3s |
-- TERMINAL -- | {3:-- TERMINAL --} |
]], tostring(maxcolors and maxcolors or ""))) ]], tline, tline, tline, tostring(maxcolors and maxcolors or "")))
end end
it("unknown TERM sets empty 't_Co'", function() it("unknown TERM sets empty 't_Co'", function()

View File

@@ -52,7 +52,7 @@ describe('terminal window', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
@@ -68,7 +68,7 @@ describe('terminal window', function()
line3 | line3 |
line4 | line4 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)

View File

@@ -32,8 +32,8 @@ describe('terminal', function()
tty ready | tty ready |
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
~ | {4:~ }|
~ | {4:~ }|
========== | ========== |
| |
]]) ]])
@@ -58,8 +58,8 @@ describe('terminal', function()
rows: 5, cols: 50 | rows: 5, cols: 50 |
rows: 2, cols: 50 | rows: 2, cols: 50 |
{2: } | {2: } |
~ | {4:~ }|
~ | {4:~ }|
========== | ========== |
:wincmd p | :wincmd p |
]]) ]])
@@ -83,7 +83,7 @@ describe('terminal', function()
| |
| |
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
screen:try_resize(screen._width - 6, screen._height - 10) screen:try_resize(screen._width - 6, screen._height - 10)
screen:expect([[ screen:expect([[
@@ -91,7 +91,7 @@ describe('terminal', function()
rows: 14, cols: 53 | rows: 14, cols: 53 |
rows: 4, cols: 47 | rows: 4, cols: 47 |
{1: } | {1: } |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)

View File

@@ -8,30 +8,21 @@ describe('Buffer highlighting', function()
local screen local screen
local curbuf local curbuf
local hl_colors = {
NonText = Screen.colors.Blue,
Question = Screen.colors.SeaGreen,
String = Screen.colors.Fuchsia,
Statement = Screen.colors.Brown,
Special = Screen.colors.SlateBlue,
Identifier = Screen.colors.DarkCyan
}
before_each(function() before_each(function()
clear() clear()
execute("syntax on") execute("syntax on")
screen = Screen.new(40, 8) screen = Screen.new(40, 8)
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=hl_colors.NonText}} )
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {foreground = hl_colors.String}, [1] = {bold=true, foreground=Screen.colors.Blue},
[2] = {foreground = hl_colors.Statement, bold = true}, [2] = {foreground = Screen.colors.Fuchsia}, -- String
[3] = {foreground = hl_colors.Special}, [3] = {foreground = Screen.colors.Brown, bold = true}, -- Statement
[4] = {bold = true, foreground = hl_colors.Special}, [4] = {foreground = Screen.colors.SlateBlue}, -- Special
[5] = {foreground = hl_colors.Identifier}, [5] = {bold = true, foreground = Screen.colors.SlateBlue},
[6] = {bold = true}, [6] = {foreground = Screen.colors.DarkCyan}, -- Identifier
[7] = {underline = true, bold = true, foreground = hl_colors.Special}, [7] = {bold = true},
[8] = {foreground = hl_colors.Special, underline = true} [8] = {underline = true, bold = true, foreground = Screen.colors.SlateBlue},
[9] = {foreground = Screen.colors.SlateBlue, underline = true}
}) })
curbuf = request('vim_get_current_buffer') curbuf = request('vim_get_current_buffer')
end) end)
@@ -58,11 +49,11 @@ describe('Buffer highlighting', function()
screen:expect([[ screen:expect([[
these are some lines | these are some lines |
with colorful tex^t | with colorful tex^t |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
@@ -70,25 +61,25 @@ describe('Buffer highlighting', function()
add_hl(-1, "Statement", 1 , 5, -1) add_hl(-1, "Statement", 1 , 5, -1)
screen:expect([[ screen:expect([[
these are {1:some} lines | these are {2:some} lines |
with {2:colorful tex^t} | with {3:colorful tex^t} |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
feed("ggo<esc>") feed("ggo<esc>")
screen:expect([[ screen:expect([[
these are {1:some} lines | these are {2:some} lines |
^ | ^ |
with {2:colorful text} | with {3:colorful text} |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
@@ -97,10 +88,10 @@ describe('Buffer highlighting', function()
these are some lines | these are some lines |
^ | ^ |
with colorful text | with colorful text |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
end) end)
@@ -128,13 +119,13 @@ describe('Buffer highlighting', function()
neq(id1, id2) neq(id1, id2)
screen:expect([[ screen:expect([[
a {4:longer} example | a {5:longer} example |
in {5:order} to {6:de}{4:monstr}{6:ate} | in {6:order} to {7:de}{5:monstr}{7:ate} |
{6:combin}{7:ing}{8: hi}ghlights | {7:combin}{8:ing}{9: hi}ghlights |
{8:from }{7:diff}{6:erent} source^s | {9:from }{8:diff}{7:erent} source^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:hi ImportantWord gui=bold cterm=bold | :hi ImportantWord gui=bold cterm=bold |
]]) ]])
end) end)
@@ -142,13 +133,13 @@ describe('Buffer highlighting', function()
it('and clearing the first added', function() it('and clearing the first added', function()
clear_hl(id1, 0, -1) clear_hl(id1, 0, -1)
screen:expect([[ screen:expect([[
a {3:longer} example | a {4:longer} example |
in {5:order} to de{3:monstr}ate | in {6:order} to de{4:monstr}ate |
combin{8:ing hi}ghlights | combin{9:ing hi}ghlights |
{8:from diff}erent source^s | {9:from diff}erent source^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:hi ImportantWord gui=bold cterm=bold | :hi ImportantWord gui=bold cterm=bold |
]]) ]])
end) end)
@@ -156,13 +147,13 @@ describe('Buffer highlighting', function()
it('and clearing the second added', function() it('and clearing the second added', function()
clear_hl(id2, 0, -1) clear_hl(id2, 0, -1)
screen:expect([[ screen:expect([[
a {6:longer} example | a {7:longer} example |
in order to {6:demonstrate} | in order to {7:demonstrate} |
{6:combining} highlights | {7:combining} highlights |
from {6:different} source^s | from {7:different} source^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:hi ImportantWord gui=bold cterm=bold | :hi ImportantWord gui=bold cterm=bold |
]]) ]])
end) end)
@@ -173,12 +164,12 @@ describe('Buffer highlighting', function()
clear_hl(id2, 2, -1) clear_hl(id2, 2, -1)
screen:expect([[ screen:expect([[
a longer example | a longer example |
in {5:order} to de{3:monstr}ate | in {6:order} to de{4:monstr}ate |
{6:combining} highlights | {7:combining} highlights |
from {6:different} source^s | from {7:different} source^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:hi ImportantWord gui=bold cterm=bold | :hi ImportantWord gui=bold cterm=bold |
]]) ]])
end) end)
@@ -186,25 +177,25 @@ describe('Buffer highlighting', function()
it('and renumbering lines', function() it('and renumbering lines', function()
feed('3Gddggo<esc>') feed('3Gddggo<esc>')
screen:expect([[ screen:expect([[
a {4:longer} example | a {5:longer} example |
^ | ^ |
in {5:order} to {6:de}{4:monstr}{6:ate} | in {6:order} to {7:de}{5:monstr}{7:ate} |
{8:from }{7:diff}{6:erent} sources | {9:from }{8:diff}{7:erent} sources |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
execute(':3move 4') execute(':3move 4')
screen:expect([[ screen:expect([[
a {4:longer} example | a {5:longer} example |
| |
{8:from }{7:diff}{6:erent} sources | {9:from }{8:diff}{7:erent} sources |
^in {5:order} to {6:de}{4:monstr}{6:ate} | ^in {6:order} to {7:de}{5:monstr}{7:ate} |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
::3move 4 | ::3move 4 |
]]) ]])
end) end)
@@ -218,25 +209,25 @@ describe('Buffer highlighting', function()
local id = add_hl(0, "Special", 0, 0, 9) local id = add_hl(0, "Special", 0, 0, 9)
screen:expect([[ screen:expect([[
{3:three ove}{5:rlapp}{1:ing color}^s | {4:three ove}{6:rlapp}{2:ing color}^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
clear_hl(id, 0, 1) clear_hl(id, 0, 1)
screen:expect([[ screen:expect([[
three {5:overlapp}{1:ing color}^s | three {6:overlapp}{2:ing color}^s |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
end) end)
@@ -248,13 +239,13 @@ describe('Buffer highlighting', function()
add_hl(-1, "String", 0, 16, 21) add_hl(-1, "String", 0, 16, 21)
screen:expect([[ screen:expect([[
Ta {5:båten} över {1:sjön}^! | Ta {6:båten} över {2:sjön}^! |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
| |
]]) ]])
end) end)

View File

@@ -27,10 +27,11 @@ describe('manual syntax highlight', function()
clear() clear()
screen = Screen.new(20,5) screen = Screen.new(20,5)
screen:attach() screen:attach()
--ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
--syntax highlight for vimcscripts "echo" --syntax highlight for vimcscripts "echo"
screen:set_default_attr_ids( {[1] = {bold=true, foreground=Screen.colors.Brown}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold=true, foreground=Screen.colors.Brown}
} )
end) end)
after_each(function() after_each(function()
@@ -53,9 +54,9 @@ describe('manual syntax highlight', function()
execute('bp') execute('bp')
screen:expect([[ screen:expect([[
{1:^echo} 1 | {1:^echo} 1 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
<f 1 --100%-- col 1 | <f 1 --100%-- col 1 |
]]) ]])
end) end)
@@ -75,9 +76,9 @@ describe('manual syntax highlight', function()
execute('bp') execute('bp')
screen:expect([[ screen:expect([[
{1:^echo} 1 | {1:^echo} 1 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
<ht.tmp.vim" 1L, 7C | <ht.tmp.vim" 1L, 7C |
]]) ]])
end) end)
@@ -89,17 +90,10 @@ describe('Default highlight groups', function()
-- command -- command
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Question = Screen.colors.SeaGreen
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
--ignore highligting of ~-lines
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} )
end) end)
after_each(function() after_each(function()
@@ -108,23 +102,24 @@ describe('Default highlight groups', function()
it('window status bar', function() it('window status bar', function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {reverse = true, bold = true}, -- StatusLine [1] = {reverse = true, bold = true}, -- StatusLine
[2] = {reverse = true} -- StatusLineNC [2] = {reverse = true} -- StatusLineNC
}) })
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
screen:expect([[ screen:expect([[
^ {2:|} {2:|} | ^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }| {1:[No Name] }{2:[No Name] [No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
@@ -132,17 +127,17 @@ describe('Default highlight groups', function()
feed('<c-w>j') feed('<c-w>j')
screen:expect([[ screen:expect([[
{2:|} {2:|} | {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] [No Name] [No Name] }| {2:[No Name] [No Name] [No Name] }|
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:[No Name] }| {1:[No Name] }|
| |
]]) ]])
@@ -152,51 +147,51 @@ describe('Default highlight groups', function()
feed('<c-w>k<c-w>l') feed('<c-w>k<c-w>l')
screen:expect([[ screen:expect([[
{2:|}^ {2:|} | {2:|}^ {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] }{1:[No Name] }{2:[No Name] }| {2:[No Name] }{1:[No Name] }{2:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
feed('<c-w>l') feed('<c-w>l')
screen:expect([[ screen:expect([[
{2:|} {2:|}^ | {2:|} {2:|}^ |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{2:[No Name] [No Name] }{1:[No Name] }| {2:[No Name] [No Name] }{1:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
feed('<c-w>h<c-w>h') feed('<c-w>h<c-w>h')
screen:expect([[ screen:expect([[
^ {2:|} {2:|} | ^ {2:|} {2:|} |
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
~ {2:|}~ {2:|}~ | {0:~ }{2:|}{0:~ }{2:|}{0:~ }|
{1:[No Name] }{2:[No Name] [No Name] }| {1:[No Name] }{2:[No Name] [No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{2:[No Name] }| {2:[No Name] }|
| |
]]) ]])
@@ -206,20 +201,21 @@ describe('Default highlight groups', function()
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {bold = true}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true}})
end) end)
it('end of file markers', function() it('end of file markers', function()
@@ -238,27 +234,28 @@ describe('Default highlight groups', function()
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
| |
]], {[1] = {bold = true, foreground = hlgroup_colors.NonText}}) ]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
end) end)
it('"wait return" text', function() it('"wait return" text', function()
feed(':ls<cr>') feed(':ls<cr>')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:ls | :ls |
1 %a "[No Name]" line 1 | 1 %a "[No Name]" line 1 |
{1:Press ENTER or type command to continue}^ | {1:Press ENTER or type command to continue}^ |
]], {[1] = {bold = true, foreground = hlgroup_colors.Question}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true, foreground = Screen.colors.SeaGreen}})
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end) end)
it('can be cleared and linked to other highlight groups', function() it('can be cleared and linked to other highlight groups', function()
@@ -266,40 +263,42 @@ describe('Default highlight groups', function()
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]], {}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold=true}})
feed('<esc>') feed('<esc>')
execute('highlight CustomHLGroup guifg=red guibg=green') execute('highlight CustomHLGroup guifg=red guibg=green')
execute('highlight link ModeMsg CustomHLGroup') execute('highlight link ModeMsg CustomHLGroup')
feed('i') feed('i')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{1:-- INSERT --} | {1:-- INSERT --} |
]], {[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
end) end)
it('can be cleared by assigning NONE', function() it('can be cleared by assigning NONE', function()
execute('syn keyword TmpKeyword neovim') execute('syn keyword TmpKeyword neovim')
@@ -307,40 +306,41 @@ describe('Default highlight groups', function()
insert('neovim') insert('neovim')
screen:expect([[ screen:expect([[
{1:neovi^m} | {1:neovi^m} |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], { ]], {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.White, background = Screen.colors.Red} [1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
}) })
execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE" execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
.. " gui=NONE guifg=NONE guibg=NONE guisp=NONE") .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
screen:expect([[ screen:expect([[
neovi^m | neovi^m |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], {}) ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
end) end)
end) end)
@@ -351,10 +351,6 @@ describe('guisp (special/undercurl)', function()
clear() clear()
screen = Screen.new(25,10) screen = Screen.new(25,10)
screen:attach() screen:attach()
screen:set_default_attr_ignore({
[1] = {bold = true, foreground = Screen.colors.Blue},
[2] = {bold = true}
})
end) end)
it('can be set and is applied like foreground or background', function() it('can be set and is applied like foreground or background', function()
@@ -389,14 +385,16 @@ describe('guisp (special/undercurl)', function()
{4:specialwithfg} | {4:specialwithfg} |
| |
{1:neovim} tabbed^ | {1:neovim} tabbed^ |
~ | {0:~ }|
-- INSERT -- | {5:-- INSERT --} |
]],{ ]],{
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red,
special = Screen.colors.Red}, special = Screen.colors.Red},
[2] = {special = Screen.colors.Red}, [2] = {special = Screen.colors.Red},
[3] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, [3] = {special = Screen.colors.Red, background = Screen.colors.Yellow},
[4] = {foreground = Screen.colors.Red, special = Screen.colors.Red}, [4] = {foreground = Screen.colors.Red, special = Screen.colors.Red},
[5] = {bold=true},
}) })
end) end)
@@ -405,13 +403,6 @@ end)
describe("'cursorline' with 'listchars'", function() describe("'cursorline' with 'listchars'", function()
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Cursorline = Screen.colors.Grey90,
SpecialKey = Screen.colors.Red,
Visual = Screen.colors.LightGrey,
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(20,5) screen = Screen.new(20,5)
@@ -423,48 +414,50 @@ describe("'cursorline' with 'listchars'", function()
end) end)
it("'cursorline' and 'cursorcolumn'", function() it("'cursorline' and 'cursorcolumn'", function()
screen:set_default_attr_ids({[1] = {background=hlgroup_colors.Cursorline}}) screen:set_default_attr_ids({
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} ) [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background=Screen.colors.Grey90}
})
execute('highlight clear ModeMsg') execute('highlight clear ModeMsg')
execute('set cursorline') execute('set cursorline')
feed('i') feed('i')
screen:expect([[ screen:expect([[
{1:^ }| {1:^ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]]) ]])
feed('abcdefg<cr>kkasdf') feed('abcdefg<cr>kkasdf')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
{1:kkasdf^ }| {1:kkasdf^ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | -- INSERT -- |
]]) ]])
feed('<esc>') feed('<esc>')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
{1:kkasd^f }| {1:kkasd^f }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
execute('set nocursorline') execute('set nocursorline')
screen:expect([[ screen:expect([[
abcdefg | abcdefg |
kkasd^f | kkasd^f |
~ | {0:~ }|
~ | {0:~ }|
:set nocursorline | :set nocursorline |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
abcde^fg | abcde^fg |
kkasdf | kkasdf |
~ | {0:~ }|
~ | {0:~ }|
:set nocursorline | :set nocursorline |
]]) ]])
feed('jjji<cr><cr><cr><esc>') feed('jjji<cr><cr><cr><esc>')
@@ -497,22 +490,22 @@ describe("'cursorline' with 'listchars'", function()
it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function() it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background=hlgroup_colors.Cursorline}, [1] = {background=Screen.colors.Grey90},
[2] = { [2] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
}, },
[3] = { [3] = {
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[4] = { [4] = {
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[5] = { [5] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
}) })
execute('highlight clear ModeMsg') execute('highlight clear ModeMsg')
@@ -581,33 +574,33 @@ describe("'cursorline' with 'listchars'", function()
it("'listchar' in visual mode", function() it("'listchar' in visual mode", function()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background=hlgroup_colors.Cursorline}, [1] = {background=Screen.colors.Grey90},
[2] = { [2] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
}, },
[3] = { [3] = {
background=hlgroup_colors.Cursorline, background=Screen.colors.Grey90,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[4] = { [4] = {
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
[5] = { [5] = {
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
[6] = { [6] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
}, },
[7] = { [7] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
foreground=hlgroup_colors.SpecialKey, foreground=Screen.colors.Red,
}, },
[8] = { [8] = {
background=hlgroup_colors.Visual, background=Screen.colors.LightGrey,
foreground=hlgroup_colors.NonText, foreground=Screen.colors.Blue,
bold=true, bold=true,
}, },
}) })

View File

@@ -7,11 +7,6 @@ local eq, funcs = helpers.eq, helpers.funcs
describe('Mouse input', function() describe('Mouse input', function()
local screen local screen
local hlgroup_colors = {
NonText = Screen.colors.Blue,
Visual = Screen.colors.LightGrey
}
before_each(function() before_each(function()
clear() clear()
meths.set_option('mouse', 'a') meths.set_option('mouse', 'a')
@@ -22,21 +17,23 @@ describe('Mouse input', function()
screen = Screen.new(25, 5) screen = Screen.new(25, 5)
screen:attach() screen:attach()
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[1] = {background = hlgroup_colors.Visual}, [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.LightGrey},
[2] = {bold = true}, [2] = {bold = true},
[3] = { [3] = {
foreground = hlgroup_colors.NonText, foreground = Screen.colors.Blue,
background = hlgroup_colors.Visual, background = Screen.colors.LightGrey,
bold = true, bold = true,
}, },
[4] = {reverse = true},
[5] = {bold = true, reverse = true},
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} )
feed('itesting<cr>mouse<cr>support and selection<esc>') feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[ screen:expect([[
testing | testing |
mouse | mouse |
support and selectio^n | support and selectio^n |
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -51,7 +48,7 @@ describe('Mouse input', function()
testing | testing |
mo^use | mo^use |
support and selection | support and selection |
~ | {0:~ }|
| |
]]) ]])
feed('<LeftMouse><0,0>') feed('<LeftMouse><0,0>')
@@ -59,7 +56,7 @@ describe('Mouse input', function()
^testing | ^testing |
mouse | mouse |
support and selection | support and selection |
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -73,7 +70,7 @@ describe('Mouse input', function()
{1:testin}^g | {1:testin}^g |
mouse | mouse |
support and selection | support and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
end) end)
@@ -89,7 +86,7 @@ describe('Mouse input', function()
^t{1:esting}{3: } | ^t{1:esting}{3: } |
mouse | mouse |
support and selection | support and selection |
~ | {0:~ }|
{2:-- VISUAL LINE --} | {2:-- VISUAL LINE --} |
]]) ]])
end) end)
@@ -107,17 +104,20 @@ describe('Mouse input', function()
^testing | ^testing |
mouse | mouse |
support and selection | support and selection |
~ | {0:~ }|
{2:-- VISUAL BLOCK --} | {2:-- VISUAL BLOCK --} |
]]) ]])
end) end)
describe('tabline', function() describe('tabline', function()
local tab_attrs = { before_each(function()
tab = { background=Screen.colors.LightGrey, underline=true }, screen:set_default_attr_ids( {
sel = { bold=true }, [0] = {bold=true, foreground=Screen.colors.Blue},
fill = { reverse=true } tab = { background=Screen.colors.LightGrey, underline=true },
} sel = { bold=true },
fill = { reverse=true }
})
end)
it('left click in default tabline (position 4) switches to tab', function() it('left click in default tabline (position 4) switches to tab', function()
execute('%delete') execute('%delete')
@@ -127,18 +127,18 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r | this is ba^r |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
feed('<LeftMouse><4,0>') feed('<LeftMouse><4,0>')
screen:expect([[ screen:expect([[
{sel: + foo }{tab: + bar }{fill: }{tab:X}| {sel: + foo }{tab: + bar }{fill: }{tab:X}|
this is fo^o | this is fo^o |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
end) end)
it('left click in default tabline (position 24) closes tab', function() it('left click in default tabline (position 24) closes tab', function()
@@ -150,18 +150,18 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r | this is ba^r |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
feed('<LeftMouse><24,0>') feed('<LeftMouse><24,0>')
screen:expect([[ screen:expect([[
this is fo^o | this is fo^o |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
end) end)
it('double click in default tabline (position 4) opens new tab', function() it('double click in default tabline (position 4) opens new tab', function()
@@ -173,18 +173,18 @@ describe('Mouse input', function()
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r | this is ba^r |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
feed('<2-LeftMouse><4,0>') feed('<2-LeftMouse><4,0>')
screen:expect([[ screen:expect([[
{sel: Name] }{tab: + foo + bar }{fill: }{tab:X}| {sel: Name] }{tab: + foo + bar }{fill: }{tab:X}|
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
end) end)
describe('%@ label', function() describe('%@ label', function()
@@ -206,9 +206,9 @@ describe('Mouse input', function()
{fill:test-test2 }| {fill:test-test2 }|
mouse | mouse |
support and selectio^n | support and selectio^n |
~ | {0:~ }|
| |
]], tab_attrs) ]])
meths.set_var('reply', {}) meths.set_var('reply', {})
end) end)
@@ -264,7 +264,7 @@ describe('Mouse input', function()
testing | testing |
mo^use | mo^use |
support and selection | support and selection |
~ | {0:~ }|
| |
]]) ]])
feed('<LeftDrag><4,1>') feed('<LeftDrag><4,1>')
@@ -272,7 +272,7 @@ describe('Mouse input', function()
testing | testing |
mo{1:us}^e | mo{1:us}^e |
support and selection | support and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
feed('<LeftDrag><2,2>') feed('<LeftDrag><2,2>')
@@ -280,7 +280,7 @@ describe('Mouse input', function()
testing | testing |
mo{1:use}{3: } | mo{1:use}{3: } |
{1:su}^pport and selection | {1:su}^pport and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
feed('<LeftDrag><0,0>') feed('<LeftDrag><0,0>')
@@ -288,18 +288,19 @@ describe('Mouse input', function()
^t{1:esting}{3: } | ^t{1:esting}{3: } |
{1:mou}se | {1:mou}se |
support and selection | support and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
end) end)
it('left drag changes visual selection after tab click', function() it('left drag changes visual selection after tab click', function()
local tab_attrs = { screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
tab = { background=Screen.colors.LightGrey, underline=true }, tab = { background=Screen.colors.LightGrey, underline=true },
sel = { bold=true }, sel = { bold=true },
fill = { reverse=true }, fill = { reverse=true },
vis = { background=Screen.colors.LightGrey } vis = { background=Screen.colors.LightGrey }
} })
execute('silent file foo | tabnew | file bar') execute('silent file foo | tabnew | file bar')
insert('this is bar') insert('this is bar')
execute('tabprevious') -- go to first tab execute('tabprevious') -- go to first tab
@@ -307,27 +308,27 @@ describe('Mouse input', function()
{sel: + foo }{tab: + bar }{fill: }{tab:X}| {sel: + foo }{tab: + bar }{fill: }{tab:X}|
mouse | mouse |
support and selectio^n | support and selectio^n |
~ | {0:~ }|
| |
]], tab_attrs) ]])
feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab feed('<LeftMouse><10,0><LeftRelease>') -- go to second tab
helpers.wait() helpers.wait()
feed('<LeftMouse><0,1>') feed('<LeftMouse><0,1>')
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|
^this is bar | ^this is bar |
~ | {0:~ }|
~ | {0:~ }|
| |
]], tab_attrs) ]])
feed('<LeftDrag><4,1>') feed('<LeftDrag><4,1>')
screen:expect([[ screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}| {tab: + foo }{sel: + bar }{fill: }{tab:X}|
{vis:this}^ is bar | {vis:this}^ is bar |
~ | {0:~ }|
~ | {0:~ }|
{sel:-- VISUAL --} | {sel:-- VISUAL --} |
]], tab_attrs) ]])
end) end)
it('two clicks will select the word and enter VISUAL', function() it('two clicks will select the word and enter VISUAL', function()
@@ -336,7 +337,7 @@ describe('Mouse input', function()
testing | testing |
mouse | mouse |
{1:suppor}^t and selection | {1:suppor}^t and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
end) end)
@@ -347,7 +348,7 @@ describe('Mouse input', function()
testing | testing |
mouse | mouse |
{1:su}^p{1:port and selection}{3: } | {1:su}^p{1:port and selection}{3: } |
~ | {0:~ }|
{2:-- VISUAL LINE --} | {2:-- VISUAL LINE --} |
]]) ]])
end) end)
@@ -358,7 +359,7 @@ describe('Mouse input', function()
testing | testing |
mouse | mouse |
su^pport and selection | su^pport and selection |
~ | {0:~ }|
{2:-- VISUAL BLOCK --} | {2:-- VISUAL BLOCK --} |
]]) ]])
end) end)
@@ -369,7 +370,7 @@ describe('Mouse input', function()
^testing | ^testing |
mouse | mouse |
support and selection | support and selection |
~ | {0:~ }|
| |
]]) ]])
feed('<RightMouse><2,2>') feed('<RightMouse><2,2>')
@@ -377,7 +378,7 @@ describe('Mouse input', function()
{1:testing}{3: } | {1:testing}{3: } |
{1:mouse}{3: } | {1:mouse}{3: } |
{1:su}^pport and selection | {1:su}^pport and selection |
~ | {0:~ }|
{2:-- VISUAL --} | {2:-- VISUAL --} |
]]) ]])
end) end)
@@ -409,73 +410,71 @@ describe('Mouse input', function()
]]) ]])
screen:try_resize(53, 14) screen:try_resize(53, 14)
execute('sp', 'vsp') execute('sp', 'vsp')
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText},
{reverse=true}, {bold=true, reverse=true}} )
screen:expect([[ screen:expect([[
lines |lines | lines {4:|}lines |
to |to | to {4:|}to |
test |test | test {4:|}test |
mouse scrolling |mouse scrolling | mouse scrolling {4:|}mouse scrolling |
^ | | ^ {4:|} |
~ |~ | {0:~ }{4:|}{0:~ }|
[No Name] [+] [No Name] [+] | {5:[No Name] [+] }{4:[No Name] [+] }|
to | to |
test | test |
mouse scrolling | mouse scrolling |
| |
~ | {0:~ }|
[No Name] [+] | {4:[No Name] [+] }|
:vsp | :vsp |
]]) ]])
feed('<MouseUp><0,0>') feed('<MouseUp><0,0>')
screen:expect([[ screen:expect([[
mouse scrolling |lines | mouse scrolling {4:|}lines |
^ |to | ^ {4:|}to |
~ |test | {0:~ }{4:|}test |
~ |mouse scrolling | {0:~ }{4:|}mouse scrolling |
~ | | {0:~ }{4:|} |
~ |~ | {0:~ }{4:|}{0:~ }|
[No Name] [+] [No Name] [+] | {5:[No Name] [+] }{4:[No Name] [+] }|
to | to |
test | test |
mouse scrolling | mouse scrolling |
| |
~ | {0:~ }|
[No Name] [+] | {4:[No Name] [+] }|
| |
]]) ]])
feed('<MouseDown><27,0>') feed('<MouseDown><27,0>')
screen:expect([[ screen:expect([[
mouse scrolling |text | mouse scrolling {4:|}text |
^ |with | ^ {4:|}with |
~ |many | {0:~ }{4:|}many |
~ |lines | {0:~ }{4:|}lines |
~ |to | {0:~ }{4:|}to |
~ |test | {0:~ }{4:|}test |
[No Name] [+] [No Name] [+] | {5:[No Name] [+] }{4:[No Name] [+] }|
to | to |
test | test |
mouse scrolling | mouse scrolling |
| |
~ | {0:~ }|
[No Name] [+] | {4:[No Name] [+] }|
| |
]]) ]])
feed('<MouseDown><27,7><MouseDown>') feed('<MouseDown><27,7><MouseDown>')
screen:expect([[ screen:expect([[
mouse scrolling |text | mouse scrolling {4:|}text |
^ |with | ^ {4:|}with |
~ |many | {0:~ }{4:|}many |
~ |lines | {0:~ }{4:|}lines |
~ |to | {0:~ }{4:|}to |
~ |test | {0:~ }{4:|}test |
[No Name] [+] [No Name] [+] | {5:[No Name] [+] }{4:[No Name] [+] }|
Inserting | Inserting |
text | text |
with | with |
many | many |
lines | lines |
[No Name] [+] | {4:[No Name] [+] }|
| |
]]) ]])
end) end)
@@ -488,7 +487,7 @@ describe('Mouse input', function()
| |
| |
bbbbbbbbbbbbbbb^b | bbbbbbbbbbbbbbb^b |
~ | {0:~ }|
| |
]]) ]])
@@ -497,7 +496,7 @@ describe('Mouse input', function()
| |
| |
n bbbbbbbbbbbbbbbbbbb^b | n bbbbbbbbbbbbbbbbbbb^b |
~ | {0:~ }|
| |
]]) ]])
@@ -506,7 +505,7 @@ describe('Mouse input', function()
g | g |
| |
^t and selection bbbbbbbbb| ^t and selection bbbbbbbbb|
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -514,12 +513,13 @@ describe('Mouse input', function()
describe('on concealed text', function() describe('on concealed text', function()
-- Helpful for reading the test expectations: -- Helpful for reading the test expectations:
-- :match Error /\^/ -- :match Error /\^/
local concealed = {
c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray }
}
before_each(function() before_each(function()
screen:try_resize(25, 7) screen:try_resize(25, 7)
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
})
feed('ggdG') feed('ggdG')
execute('set concealcursor=n') execute('set concealcursor=n')
@@ -545,44 +545,44 @@ describe('Mouse input', function()
{c:^Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con| {c:^Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no| {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><1,0>') feed('<esc><LeftMouse><1,0>')
screen:expect([[ screen:expect([[
{c:Y}^rem ip{c:X}um do{c: } {c:X}it {c: }, con| {c:Y}^rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no| {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,0>') feed('<esc><LeftMouse><15,0>')
screen:expect([[ screen:expect([[
{c:Y}rem ip{c:X}um do{c: } {c:^X}it {c: }, con| {c:Y}rem ip{c:X}um do{c: } {c:^X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no| {c:X}tet {c: }ta ka{c:X}d {c:X}ber{c:X}en, no|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
{c:Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con| {c:Y}rem ip{c:X}um do{c: } {c:X}it {c: }, con|
{c:X}tet {c: }ta ka{c:X}d {c:X}^ber{c:X}en, no| {c:X}tet {c: }ta ka{c:X}d {c:X}^ber{c:X}en, no|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
end) -- level 1 - non wrapped end) -- level 1 - non wrapped
it('(level 1) click on wrapped lines', function() it('(level 1) click on wrapped lines', function()
@@ -597,7 +597,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><6,1>') feed('<esc><LeftMouse><6,1>')
screen:expect([[ screen:expect([[
@@ -608,7 +608,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
@@ -619,7 +619,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,3>') feed('<esc><LeftMouse><15,3>')
screen:expect([[ screen:expect([[
@@ -630,7 +630,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
end) -- level 1 - wrapped end) -- level 1 - wrapped
@@ -642,44 +642,44 @@ describe('Mouse input', function()
{c:^Y}rem ip{c:X}um do {c:X}it , con{c:X}e| {c:^Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no | {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><1,0>') feed('<esc><LeftMouse><1,0>')
screen:expect([[ screen:expect([[
{c:Y}^rem ip{c:X}um do {c:X}it , con{c:X}e| {c:Y}^rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no | {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,0>') feed('<esc><LeftMouse><15,0>')
screen:expect([[ screen:expect([[
{c:Y}rem ip{c:X}um do {c:X}^it , con{c:X}e| {c:Y}rem ip{c:X}um do {c:X}^it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no | {c:X}tet ta ka{c:X}d {c:X}ber{c:X}en, no |
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
{c:Y}rem ip{c:X}um do {c:X}it , con{c:X}e| {c:Y}rem ip{c:X}um do {c:X}it , con{c:X}e|
{c:X}tet ta ka{c:X}d {c:X}b^er{c:X}en, no | {c:X}tet ta ka{c:X}d {c:X}b^er{c:X}en, no |
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
end) -- level 2 - non wrapped end) -- level 2 - non wrapped
it('(level 2) click on wrapped lines', function() it('(level 2) click on wrapped lines', function()
@@ -694,7 +694,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><6,1>') feed('<esc><LeftMouse><6,1>')
screen:expect([[ screen:expect([[
@@ -705,7 +705,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
@@ -716,7 +716,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,3>') feed('<esc><LeftMouse><15,3>')
screen:expect([[ screen:expect([[
@@ -727,7 +727,7 @@ describe('Mouse input', function()
, no {c:X}ea takimata {c:X}anctu{c:X}| , no {c:X}ea takimata {c:X}anctu{c:X}|
e{c:X}t. | e{c:X}t. |
| |
]], concealed) ]])
end) -- level 2 - wrapped end) -- level 2 - wrapped
@@ -739,44 +739,44 @@ describe('Mouse input', function()
^rem ipum do it , conetetu| ^rem ipum do it , conetetu|
tet ta kad beren, no ea t| tet ta kad beren, no ea t|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><1,0>') feed('<esc><LeftMouse><1,0>')
screen:expect([[ screen:expect([[
r^em ipum do it , conetetu| r^em ipum do it , conetetu|
tet ta kad beren, no ea t| tet ta kad beren, no ea t|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,0>') feed('<esc><LeftMouse><15,0>')
screen:expect([[ screen:expect([[
rem ipum do it ^, conetetu| rem ipum do it ^, conetetu|
tet ta kad beren, no ea t| tet ta kad beren, no ea t|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
rem ipum do it , conetetu| rem ipum do it , conetetu|
tet ta kad bere^n, no ea t| tet ta kad bere^n, no ea t|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]], concealed) ]])
end) -- level 3 - non wrapped end) -- level 3 - non wrapped
it('(level 3) click on wrapped lines', function() it('(level 3) click on wrapped lines', function()
@@ -791,7 +791,7 @@ describe('Mouse input', function()
, no ea takimata anctu | , no ea takimata anctu |
et. | et. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><6,1>') feed('<esc><LeftMouse><6,1>')
screen:expect([[ screen:expect([[
@@ -802,7 +802,7 @@ describe('Mouse input', function()
, no ea takimata anctu | , no ea takimata anctu |
et. | et. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,1>') feed('<esc><LeftMouse><15,1>')
screen:expect([[ screen:expect([[
@@ -813,7 +813,7 @@ describe('Mouse input', function()
, no ea takimata anctu | , no ea takimata anctu |
et. | et. |
| |
]], concealed) ]])
feed('<esc><LeftMouse><15,3>') feed('<esc><LeftMouse><15,3>')
screen:expect([[ screen:expect([[
@@ -824,7 +824,7 @@ describe('Mouse input', function()
, no ea takimata anctu | , no ea takimata anctu |
et. | et. |
| |
]], concealed) ]])
end) -- level 3 - wrapped end) -- level 3 - wrapped
end) end)
end) end)

View File

@@ -9,12 +9,12 @@ describe("shell command :!", function()
'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') '", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]')
screen:expect([[ screen:expect([[
{1: } | {1: } |
~ | {4:~ }|
~ | {4:~ }|
~ | {4:~ }|
[No Name] | {5:[No Name] }|
| |
-- TERMINAL -- | {3:-- TERMINAL --} |
]]) ]])
end) end)
@@ -27,13 +27,13 @@ describe("shell command :!", function()
-- to avoid triggering a UI flush. -- to avoid triggering a UI flush.
child_session.feed_data(":!printf foo; sleep 200\n") child_session.feed_data(":!printf foo; sleep 200\n")
screen:expect([[ screen:expect([[
~ | {1: } |
~ | {4:~ }|
[No Name] | {4:~ }|
:!printf foo; sleep 200 | {4:~ }|
{5:[No Name] }|
| |
foo | {3:-- TERMINAL --} |
-- TERMINAL -- |
]]) ]])
end) end)
end) end)

View File

@@ -234,8 +234,10 @@ function Screen:expect(expected, attr_ids, attr_ignore)
return ( return (
'Row ' .. tostring(i) .. ' didn\'t match.\n' 'Row ' .. tostring(i) .. ' didn\'t match.\n'
.. 'Expected:\n|' .. table.concat(msg_expected_rows, '|\n|') .. '|\n' .. 'Expected:\n|' .. table.concat(msg_expected_rows, '|\n|') .. '|\n'
.. 'Actual:\n|' .. table.concat(actual_rows, '|\n|') .. '|' .. 'Actual:\n|' .. table.concat(actual_rows, '|\n|') .. '|\n\n' .. [[
) To print the expect() call that would assert the current screen state, use
screen:snaphot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states. ]])
end end
end end
end) end)

View File

@@ -15,7 +15,10 @@ describe('Initial screen', function()
set_session(screen_nvim) set_session(screen_nvim)
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=255}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {bold=true, reverse=true},
} )
end) end)
after_each(function() after_each(function()
@@ -25,18 +28,18 @@ describe('Initial screen', function()
it('is the default initial screen', function() it('is the default initial screen', function()
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {1:[No Name] }|
| |
]]) ]])
end) end)
@@ -49,7 +52,16 @@ describe('Screen', function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=255}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {bold=true, reverse=true},
[2] = {bold=true},
[3] = {reverse=true},
[4] = {background = Screen.colors.LightGrey, underline = true},
[5] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Fuchsia},
[6] = {bold = true, foreground = Screen.colors.Fuchsia},
[7] = {bold = true, foreground = Screen.colors.SeaGreen},
} )
end) end)
after_each(function() after_each(function()
@@ -147,18 +159,18 @@ describe('Screen', function()
execute('sp') execute('sp')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {1:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {3:[No Name] }|
:sp | :sp |
]]) ]])
end) end)
@@ -168,18 +180,18 @@ describe('Screen', function()
execute('resize 8') execute('resize 8')
screen:expect([[ screen:expect([[
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {1:[No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {3:[No Name] }|
:resize 8 | :resize 8 |
]]) ]])
end) end)
@@ -187,36 +199,36 @@ describe('Screen', function()
it('horizontal and vertical', function() it('horizontal and vertical', function()
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
screen:expect([[ screen:expect([[
^ | | | ^ {3:|} {3:|} |
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
[No Name] [No Name] [No Name] | {1:[No Name] }{3:[No Name] [No Name] }|
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] | {3:[No Name] }|
| |
]]) ]])
insert('hello') insert('hello')
screen:expect([[ screen:expect([[
hell^o |hello |hello | hell^o {3:|}hello {3:|}hello |
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
[No Name] [+] [No Name] [+] [No Name] [+] | {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello | hello |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
end) end)
@@ -228,55 +240,55 @@ describe('Screen', function()
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
insert('hello') insert('hello')
screen:expect([[ screen:expect([[
hell^o |hello |hello | hell^o {3:|}hello {3:|}hello |
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
[No Name] [+] [No Name] [+] [No Name] [+] | {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello | hello |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
execute('tabnew') execute('tabnew')
insert('hello2') insert('hello2')
feed('h') feed('h')
screen:expect([[ screen:expect([[
4+ [No Name] + [No Name] X| {4: }{5:4}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
hell^o2 | hell^o2 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
execute('tabprevious') execute('tabprevious')
screen:expect([[ screen:expect([[
4+ [No Name] + [No Name] X| {2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
hell^o |hello |hello | hell^o {3:|}hello {3:|}hello |
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
~ |~ |~ | {0:~ }{3:|}{0:~ }{3:|}{0:~ }|
[No Name] [+] [No Name] [+] [No Name] [+] | {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
hello | hello |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
end) end)
@@ -289,17 +301,17 @@ describe('Screen', function()
line 1 | line 1 |
line 2 | line 2 |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | {2:-- INSERT --} |
]]) ]])
end) end)
end) end)
@@ -314,17 +326,17 @@ describe('Screen', function()
screen:expect([[ screen:expect([[
0123^456 | 0123^456 |
789 | 789 |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:set ruler 1,5 All | :set ruler 1,5 All |
]]) ]])
end) end)
@@ -335,18 +347,18 @@ describe('Screen', function()
feed(':ls') feed(':ls')
screen:expect([[ screen:expect([[
| |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:ls^ | :ls^ |
]]) ]])
end) end)
@@ -354,20 +366,20 @@ describe('Screen', function()
it('execute command with multi-line output', function() it('execute command with multi-line output', function()
feed(':ls<cr>') feed(':ls<cr>')
screen:expect([[ screen:expect([[
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:ls | :ls |
1 %a "[No Name]" line 1 | 1 %a "[No Name]" line 1 |
Press ENTER or type command to continue^ | {7:Press ENTER or type command to continue}^ |
]]) ]])
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end) end)
@@ -392,19 +404,19 @@ describe('Screen', function()
]]) ]])
execute('sp', 'vsp', 'vsp') execute('sp', 'vsp', 'vsp')
screen:expect([[ screen:expect([[
and |and |and | and {3:|}and {3:|}and |
clearing |clearing |clearing | clearing {3:|}clearing {3:|}clearing |
in |in |in | in {3:|}in {3:|}in |
split |split |split | split {3:|}split {3:|}split |
windows |windows |windows | windows {3:|}windows {3:|}windows |
^ | | | ^ {3:|} {3:|} |
[No Name] [+] [No Name] [+] [No Name] [+] | {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
end) end)
@@ -412,121 +424,121 @@ describe('Screen', function()
it('only affects the current scroll region', function() it('only affects the current scroll region', function()
feed('6k') feed('6k')
screen:expect([[ screen:expect([[
^scrolling |and |and | ^scrolling {3:|}and {3:|}and |
and |clearing |clearing | and {3:|}clearing {3:|}clearing |
clearing |in |in | clearing {3:|}in {3:|}in |
in |split |split | in {3:|}split {3:|}split |
split |windows |windows | split {3:|}windows {3:|}windows |
windows | | | windows {3:|} {3:|} |
[No Name] [+] [No Name] [+] [No Name] [+] | {1:[No Name] [+] }{3:[No Name] [+] [No Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('<c-w>l') feed('<c-w>l')
screen:expect([[ screen:expect([[
scrolling |and |and | scrolling {3:|}and {3:|}and |
and |clearing |clearing | and {3:|}clearing {3:|}clearing |
clearing |in |in | clearing {3:|}in {3:|}in |
in |split |split | in {3:|}split {3:|}split |
split |windows |windows | split {3:|}windows {3:|}windows |
windows |^ | | windows {3:|}^ {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('gg') feed('gg')
screen:expect([[ screen:expect([[
scrolling |^Inserting |and | scrolling {3:|}^Inserting {3:|}and |
and |text |clearing | and {3:|}text {3:|}clearing |
clearing |with |in | clearing {3:|}with {3:|}in |
in |many |split | in {3:|}many {3:|}split |
split |lines |windows | split {3:|}lines {3:|}windows |
windows |to | | windows {3:|}to {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('7j') feed('7j')
screen:expect([[ screen:expect([[
scrolling |with |and | scrolling {3:|}with {3:|}and |
and |many |clearing | and {3:|}many {3:|}clearing |
clearing |lines |in | clearing {3:|}lines {3:|}in |
in |to |split | in {3:|}to {3:|}split |
split |test |windows | split {3:|}test {3:|}windows |
windows |^scrolling | | windows {3:|}^scrolling {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('2j') feed('2j')
screen:expect([[ screen:expect([[
scrolling |lines |and | scrolling {3:|}lines {3:|}and |
and |to |clearing | and {3:|}to {3:|}clearing |
clearing |test |in | clearing {3:|}test {3:|}in |
in |scrolling |split | in {3:|}scrolling {3:|}split |
split |and |windows | split {3:|}and {3:|}windows |
windows |^clearing | | windows {3:|}^clearing {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('5k') feed('5k')
screen:expect([[ screen:expect([[
scrolling |^lines |and | scrolling {3:|}^lines {3:|}and |
and |to |clearing | and {3:|}to {3:|}clearing |
clearing |test |in | clearing {3:|}test {3:|}in |
in |scrolling |split | in {3:|}scrolling {3:|}split |
split |and |windows | split {3:|}and {3:|}windows |
windows |clearing | | windows {3:|}clearing {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
feed('k') feed('k')
screen:expect([[ screen:expect([[
scrolling |^many |and | scrolling {3:|}^many {3:|}and |
and |lines |clearing | and {3:|}lines {3:|}clearing |
clearing |to |in | clearing {3:|}to {3:|}in |
in |test |split | in {3:|}test {3:|}split |
split |scrolling |windows | split {3:|}scrolling {3:|}windows |
windows |and | | windows {3:|}and {3:|} |
[No Name] [+] [No Name] [+] <Name] [+] | {3:[No Name] [+] }{1:[No Name] [+] }{3:<Name] [+] }|
clearing | clearing |
in | in |
split | split |
windows | windows |
| |
[No Name] [+] | {3:[No Name] [+] }|
| |
]]) ]])
end) end)
@@ -541,10 +553,10 @@ describe('Screen', function()
it('rebuilds the whole screen', function() it('rebuilds the whole screen', function()
screen:expect([[ screen:expect([[
resize^ | resize^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
-- INSERT -- | {2:-- INSERT --} |
]]) ]])
end) end)

View File

@@ -6,23 +6,17 @@ local execute = helpers.execute
describe('search highlighting', function() describe('search highlighting', function()
local screen local screen
local colors = Screen.colors local colors = Screen.colors
local hl_colors = {
NonText = colors.Blue,
Search = colors.Yellow,
Message = colors.Red,
}
before_each(function() before_each(function()
clear() clear()
screen = Screen.new(40, 7) screen = Screen.new(40, 7)
screen:attach() screen:attach()
--ignore highligting of ~-lines
screen:set_default_attr_ids( { screen:set_default_attr_ids( {
[1] = {background = hl_colors.Search}, [1] = {bold=true, foreground=Screen.colors.Blue},
[2] = {reverse = true}, [2] = {background = colors.Yellow}, -- Search
[3] = {foreground = hl_colors.Message}, [3] = {reverse = true},
[4] = {foreground = colors.Red}, -- Message
}) })
screen:set_default_attr_ignore( {{bold=true, foreground=hl_colors.NonText}} )
end) end)
it('is disabled by ":set nohlsearch"', function() it('is disabled by ":set nohlsearch"', function()
@@ -32,10 +26,10 @@ describe('search highlighting', function()
screen:expect([[ screen:expect([[
some ^text | some ^text |
more text | more text |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/text | /text |
]]) ]])
end) end)
@@ -51,35 +45,35 @@ describe('search highlighting', function()
-- 'hlsearch' is enabled by default. #2859 -- 'hlsearch' is enabled by default. #2859
feed("gg/text<cr>") feed("gg/text<cr>")
screen:expect([[ screen:expect([[
some {1:^text} | some {2:^text} |
more {1:text}stuff | more {2:text}stuff |
stupid{1:texttext}stuff | stupid{2:texttext}stuff |
a {1:text} word | a {2:text} word |
| |
~ | {1:~ }|
/text | /text |
]]) ]])
-- overlapping matches not allowed -- overlapping matches not allowed
feed("3nx") feed("3nx")
screen:expect([[ screen:expect([[
some {1:text} | some {2:text} |
more {1:text}stuff | more {2:text}stuff |
stupid{1:text}^extstuff | stupid{2:text}^extstuff |
a {1:text} word | a {2:text} word |
| |
~ | {1:~ }|
/text | /text |
]]) ]])
feed("ggn*") -- search for entire word feed("ggn*") -- search for entire word
screen:expect([[ screen:expect([[
some {1:text} | some {2:text} |
more textstuff | more textstuff |
stupidtextextstuff | stupidtextextstuff |
a {1:^text} word | a {2:^text} word |
| |
~ | {1:~ }|
/\<text\> | /\<text\> |
]]) ]])
@@ -90,7 +84,7 @@ describe('search highlighting', function()
stupidtextextstuff | stupidtextextstuff |
a ^text word | a ^text word |
| |
~ | {1:~ }|
:nohlsearch | :nohlsearch |
]]) ]])
end) end)
@@ -104,45 +98,45 @@ describe('search highlighting', function()
]]) ]])
feed("gg/li") feed("gg/li")
screen:expect([[ screen:expect([[
the first {2:li}ne | the first {3:li}ne |
in a little file | in a little file |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/li^ | /li^ |
]]) ]])
feed("t") feed("t")
screen:expect([[ screen:expect([[
the first line | the first line |
in a {2:lit}tle file | in a {3:lit}tle file |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/lit^ | /lit^ |
]]) ]])
feed("<cr>") feed("<cr>")
screen:expect([[ screen:expect([[
the first line | the first line |
in a {1:^lit}tle file | in a {2:^lit}tle file |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/lit | /lit |
]]) ]])
feed("/fir") feed("/fir")
screen:expect([[ screen:expect([[
the {2:fir}st line | the {3:fir}st line |
in a {1:lit}tle file | in a {2:lit}tle file |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/fir^ | /fir^ |
]]) ]])
@@ -150,11 +144,11 @@ describe('search highlighting', function()
feed("<esc>/ttle") feed("<esc>/ttle")
screen:expect([[ screen:expect([[
the first line | the first line |
in a {1:li}{2:ttle} file | in a {2:li}{3:ttle} file |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/ttle^ | /ttle^ |
]]) ]])
end) end)
@@ -168,12 +162,12 @@ describe('search highlighting', function()
feed("gg/mat/e") feed("gg/mat/e")
screen:expect([[ screen:expect([[
not the {2:mat}ch you're looking for | not the {3:mat}ch you're looking for |
the match is here | the match is here |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/mat/e^ | /mat/e^ |
]]) ]])
@@ -181,22 +175,22 @@ describe('search highlighting', function()
feed("<esc>2/mat/e") feed("<esc>2/mat/e")
screen:expect([[ screen:expect([[
not the match you're looking for | not the match you're looking for |
the {2:mat}ch is here | the {3:mat}ch is here |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/mat/e^ | /mat/e^ |
]]) ]])
feed("<cr>") feed("<cr>")
screen:expect([[ screen:expect([[
not the {1:mat}ch you're looking for | not the {2:mat}ch you're looking for |
the {1:ma^t}ch is here | the {2:ma^t}ch is here |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
/mat/e | /mat/e |
]]) ]])
end) end)
@@ -207,28 +201,37 @@ describe('search highlighting', function()
feed('/line\\na<cr>') feed('/line\\na<cr>')
screen:expect([[ screen:expect([[
| |
a repeated {1:^line} | a repeated {2:^line} |
{1:a} repeated {1:line} | {2:a} repeated {2:line} |
{1:a} repeated {1:line} | {2:a} repeated {2:line} |
{1:a} repeated line | {2:a} repeated line |
~ | {1:~ }|
{3:search hit BOTTOM, continuing at TOP} | {4:search hit BOTTOM, continuing at TOP} |
]]) ]])
-- it redraws rows above the changed one -- it redraws rows above the changed one
feed('4Grb') feed('4Grb')
screen:expect([[ screen:expect([[
| |
a repeated {1:line} | a repeated {2:line} |
{1:a} repeated line | {2:a} repeated line |
^b repeated {1:line} | ^b repeated {2:line} |
{1:a} repeated line | {2:a} repeated line |
~ | {1:~ }|
{3:search hit BOTTOM, continuing at TOP} | {4:search hit BOTTOM, continuing at TOP} |
]]) ]])
end) end)
it('works with matchadd and syntax', function() it('works with matchadd and syntax', function()
screen:set_default_attr_ids( {
[1] = {bold=true, foreground=Screen.colors.Blue},
[2] = {background = colors.Yellow},
[3] = {reverse = true},
[4] = {foreground = colors.Red},
[5] = {bold = true, background = colors.Green},
[6] = {italic = true, background = colors.Magenta},
[7] = {bold = true, background = colors.Yellow},
} )
execute('set hlsearch') execute('set hlsearch')
insert([[ insert([[
very special text very special text
@@ -243,25 +246,23 @@ describe('search highlighting', function()
-- is used (and matches with lower priorities are not combined) -- is used (and matches with lower priorities are not combined)
execute("/ial te") execute("/ial te")
screen:expect([[ screen:expect([[
very {4:spec^ial}{1: te}{5:xt} | very {5:spec^ial}{2: te}{6:xt} |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
{3:search hit BOTTOM, continuing at TOP} | {4:search hit BOTTOM, continuing at TOP} |
]], {[1] = {background = hl_colors.Search}, [2] = {reverse = true}, ]])
[3] = {foreground = hl_colors.Message}, [4] = {bold = true, background =
colors.Green}, [5] = {italic = true, background = colors.Magenta}})
execute("call clearmatches()") execute("call clearmatches()")
screen:expect([[ screen:expect([[
very spec{1:^ial te}xt | very spec{2:^ial te}xt |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:call clearmatches() | :call clearmatches() |
]]) ]])
@@ -269,16 +270,14 @@ describe('search highlighting', function()
-- nonconflicting attributes are combined -- nonconflicting attributes are combined
execute("syntax keyword MyGroup special") execute("syntax keyword MyGroup special")
screen:expect([[ screen:expect([[
very {4:spec}{5:^ial}{1: te}xt | very {5:spec}{7:^ial}{2: te}xt |
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:syntax keyword MyGroup special | :syntax keyword MyGroup special |
]], {[1] = {background = hl_colors.Search}, [2] = {reverse = true}, ]])
[3] = {foreground = hl_colors.Message}, [4] = {bold = true,
background = colors.Green}, [5] = {bold = true, background = hl_colors.Search}})
end) end)
end) end)

View File

@@ -9,7 +9,11 @@ describe('Signs', function()
clear() clear()
screen = Screen.new() screen = Screen.new()
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{}, {bold=true, foreground=255}} ) screen:set_default_attr_ids( {
[0] = {bold=true, foreground=255},
[1] = {background = Screen.colors.Yellow},
[2] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey},
} )
end) end)
after_each(function() after_each(function()
@@ -25,19 +29,19 @@ describe('Signs', function()
execute('sign place 2 line=3 name=piet buffer=1') execute('sign place 2 line=3 name=piet buffer=1')
execute('sign place 3 line=1 name=pietx buffer=1') execute('sign place 3 line=1 name=pietx buffer=1')
screen:expect([[ screen:expect([[
>!a | {1:>!}a |
b | {2: }b |
>>c | {1:>>}c |
^ | {2: }^ |
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
~ | {2: }{0:~ }|
:sign place 3 line=1 name=pietx buffer=1 | :sign place 3 line=1 name=pietx buffer=1 |
]]) ]])
end) end)

View File

@@ -10,8 +10,10 @@ describe('Screen', function()
clear() clear()
screen = Screen.new(nil,10) screen = Screen.new(nil,10)
screen:attach() screen:attach()
screen:set_default_attr_ignore( {{bold=true, foreground=255}} ) screen:set_default_attr_ids( {
screen:set_default_attr_ids( {{foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray}} ) [0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray}
} )
end) end)
after_each(function() after_each(function()
@@ -46,8 +48,8 @@ describe('Screen', function()
{1:∧} | {1:∧} |
{1:∧} | {1:∧} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
:syn match dAmpersand '[&][&]' conceal cchar=∧ | :syn match dAmpersand '[&][&]' conceal cchar=∧ |
]]) ]])
end) end)
@@ -62,8 +64,8 @@ describe('Screen', function()
{1:∧} | {1:∧} |
^&& | ^&& |
| |
~ | {0:~ }|
~ | {0:~ }|
:syn match dAmpersand '[&][&]' conceal cchar=∧ | :syn match dAmpersand '[&][&]' conceal cchar=∧ |
]]) ]])
end) end)
@@ -78,8 +80,8 @@ describe('Screen', function()
{1:∧} | {1:∧} |
{1:∧} | {1:∧} |
| |
~ | {0:~ }|
~ | {0:~ }|
:syn match dAmpersand '[&][&]' conceal cchar=∧ | :syn match dAmpersand '[&][&]' conceal cchar=∧ |
]]) ]])
end) end)
@@ -94,8 +96,8 @@ describe('Screen', function()
{1:∧} | {1:∧} |
{1:∧} | {1:∧} |
| |
~ | {0:~ }|
~ | {0:~ }|
:syn match dAmpersand '[&][&]' conceal cchar=∧ | :syn match dAmpersand '[&][&]' conceal cchar=∧ |
]]) ]])
end) end)
@@ -110,8 +112,8 @@ describe('Screen', function()
{1:∧} | {1:∧} |
{1:∧} | {1:∧} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
:syn match dAmpersand '[&][&]' conceal cchar=∧ | :syn match dAmpersand '[&][&]' conceal cchar=∧ |
]]) ]])
end) end)
@@ -125,12 +127,12 @@ describe('Screen', function()
{1:λ} | {1:λ} |
{1:λ} | {1:λ} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:syn keyword kLambda lambda conceal cchar=λ | :syn keyword kLambda lambda conceal cchar=λ |
]]) ]])
end) -- Keyword end) -- Keyword
@@ -149,12 +151,12 @@ describe('Screen', function()
{1:R} | {1:R} |
{1:R} | {1:R} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -167,12 +169,12 @@ describe('Screen', function()
{1: } a region of text {1:-} | {1: } a region of text {1:-} |
{1: } a region of text {1:-} | {1: } a region of text {1:-} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -186,10 +188,10 @@ describe('Screen', function()
{1: } A region with {1: } a nested {1: } nested region.{1:-} | {1: } A region with {1: } a nested {1: } nested region.{1:-} |
{1:-} {1:-} | {1:-} {1:-} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
end) end)
@@ -208,12 +210,12 @@ describe('Screen', function()
{1:-} | {1:-} |
{1:-} | {1:-} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:syn region rText start='<r>' end='</r>' cchar=- | :syn region rText start='<r>' end='</r>' cchar=- |
]]) ]])
end) end)
@@ -229,10 +231,10 @@ describe('Screen', function()
<i> italian text </i> | <i> italian text </i> |
<i> italian text </i> | <i> italian text </i> |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:syn region iText start='<i>' end='</i>' cchar=* | :syn region iText start='<i>' end='</i>' cchar=* |
]]) ]])
execute("syntax conceal on") execute("syntax conceal on")
@@ -243,10 +245,10 @@ describe('Screen', function()
{1:*} | {1:*} |
{1:*} | {1:*} |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:syn region iText start='<i>' end='</i>' cchar=* | :syn region iText start='<i>' end='</i>' cchar=* |
]]) ]])
end) end)
@@ -271,10 +273,10 @@ describe('Screen', function()
+ With cchar | + With cchar |
| |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:let &conceallevel=0 | :let &conceallevel=0 |
]]) ]])
end) end)
@@ -287,10 +289,10 @@ describe('Screen', function()
{1:C} | {1:C} |
| |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:let &conceallevel=1 | :let &conceallevel=1 |
]]) ]])
end) end)
@@ -303,10 +305,10 @@ describe('Screen', function()
{1:C} | {1:C} |
| |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:let &conceallevel=2 | :let &conceallevel=2 |
]]) ]])
end) end)
@@ -319,10 +321,10 @@ describe('Screen', function()
| |
| |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
:let &conceallevel=3 | :let &conceallevel=3 |
]]) ]])
end) end)

View File

@@ -39,7 +39,7 @@ describe('command line completion', function()
clear() clear()
screen = Screen.new(40, 5) screen = Screen.new(40, 5)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}}) screen:set_default_attr_ids({[1]={bold=true, foreground=Screen.colors.Blue}})
end) end)
after_each(function() after_each(function()
@@ -55,9 +55,9 @@ describe('command line completion', function()
feed(':!<tab><bs>') feed(':!<tab><bs>')
screen:expect([[ screen:expect([[
| |
~ | {1:~ }|
~ | {1:~ }|
~ | {1:~ }|
:!Xtest-functional-viml-compl-dir^ | :!Xtest-functional-viml-compl-dir^ |
]]) ]])
end) end)

View File

@@ -11,8 +11,8 @@ describe('completion', function()
clear() clear()
screen = Screen.new(60, 8) screen = Screen.new(60, 8)
screen:attach() screen:attach()
screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}})
screen:set_default_attr_ids({ screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.LightMagenta}, [1] = {background = Screen.colors.LightMagenta},
[2] = {background = Screen.colors.Grey}, [2] = {background = Screen.colors.Grey},
[3] = {bold = true}, [3] = {bold = true},
@@ -20,6 +20,8 @@ describe('completion', function()
[5] = {foreground = Screen.colors.Red}, [5] = {foreground = Screen.colors.Red},
[6] = {background = Screen.colors.Black}, [6] = {background = Screen.colors.Black},
[7] = {foreground = Screen.colors.White, background = Screen.colors.Red}, [7] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[8] = {reverse = true},
[9] = {bold = true, reverse = true},
}) })
end) end)
@@ -32,22 +34,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
foo^ | foo^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) The only match} | {3:-- Keyword Local completion (^N^P) The only match} |
]]) ]])
feed('<C-e>') feed('<C-e>')
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<ESC>') feed('<ESC>')
@@ -95,12 +97,12 @@ describe('completion', function()
eq('foo', eval('getline(1)')) eq('foo', eval('getline(1)'))
screen:expect([[ screen:expect([[
foo^ | foo^ |
{2:bar foobaz baz } | {2:bar foobaz baz }{0: }|
{1:abbr kind menu } | {1:abbr kind menu }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Omni completion (^O^N^P) }{4:match 1 of 2} | {3:-- Omni completion (^O^N^P) }{4:match 1 of 2} |
]]) ]])
eq({word = 'foo', abbr = 'bar', menu = 'baz', eq({word = 'foo', abbr = 'bar', menu = 'baz',
@@ -125,11 +127,11 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<C-x>') feed('<C-x>')
@@ -137,22 +139,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} |
]]) ]])
feed('<C-n>') feed('<C-n>')
screen:expect([[ screen:expect([[
foo | foo |
foo^ | foo^ |
{2:foo } | {2:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) The only match} | {3:-- Keyword Local completion (^N^P) The only match} |
]]) ]])
feed('bar<ESC>') feed('bar<ESC>')
@@ -162,10 +164,10 @@ describe('completion', function()
foo | foo |
foobar | foobar |
foo^ | foo^ |
{2:foo } | {2:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
eq('foo', eval('getline(3)')) eq('foo', eval('getline(3)'))
@@ -176,22 +178,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
{2:foo } | {2:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) The only match} | {3:-- Keyword Local completion (^N^P) The only match} |
]]) ]])
feed('<C-y>') feed('<C-y>')
screen:expect([[ screen:expect([[
foo | foo |
foo^ | foo^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<ESC>') feed('<ESC>')
@@ -201,10 +203,10 @@ describe('completion', function()
foo | foo |
foo | foo |
^ | ^ |
{2:foo } | {2:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<C-y><ESC>') feed('<C-y><ESC>')
@@ -216,22 +218,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
{1:foo } | {1:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) }{5:Back at original} | {3:-- Keyword Local completion (^N^P) }{5:Back at original} |
]]) ]])
feed('b') feed('b')
screen:expect([[ screen:expect([[
foo | foo |
b^ | b^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) }{5:Back at original} | {3:-- Keyword Local completion (^N^P) }{5:Back at original} |
]]) ]])
feed('ar<ESC>') feed('ar<ESC>')
@@ -241,10 +243,10 @@ describe('completion', function()
foo | foo |
bar | bar |
^ | ^ |
{1:foo } | {1:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('bar<ESC>') feed('bar<ESC>')
@@ -256,22 +258,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
{1:foo } | {1:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword Local completion (^N^P) }{5:Back at original} | {3:-- Keyword Local completion (^N^P) }{5:Back at original} |
]]) ]])
feed('<ESC>') feed('<ESC>')
screen:expect([[ screen:expect([[
foo | foo |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
eq('', eval('getline(2)')) eq('', eval('getline(2)'))
@@ -280,10 +282,10 @@ describe('completion', function()
foo | foo |
| |
^ | ^ |
{1:foo } | {1:foo }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<ESC>') feed('<ESC>')
@@ -291,10 +293,10 @@ describe('completion', function()
foo | foo |
| |
^ | ^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
eq('', eval('getline(3)')) eq('', eval('getline(3)'))
@@ -344,56 +346,56 @@ describe('completion', function()
feed('i<C-x><C-u>') feed('i<C-x><C-u>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:January }{6: } | {1:January }{6: }{0: }|
{1:February }{6: } | {1:February }{6: }{0: }|
{1:March }{6: } | {1:March }{6: }{0: }|
{1:April }{2: } | {1:April }{2: }{0: }|
{1:May }{2: } | {1:May }{2: }{0: }|
{1:June }{2: } | {1:June }{2: }{0: }|
{3:-- User defined completion (^U^N^P) }{5:Back at original} | {3:-- User defined completion (^U^N^P) }{5:Back at original} |
]]) ]])
feed('u') feed('u')
screen:expect([[ screen:expect([[
u^ | u^ |
{1:January } | {1:January }{0: }|
{1:February } | {1:February }{0: }|
{1:June } | {1:June }{0: }|
{1:July } | {1:July }{0: }|
{1:August } | {1:August }{0: }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{5:Back at original} | {3:-- User defined completion (^U^N^P) }{5:Back at original} |
]]) ]])
feed('g') feed('g')
screen:expect([[ screen:expect([[
ug^ | ug^ |
{1:August } | {1:August }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{5:Back at original} | {3:-- User defined completion (^U^N^P) }{5:Back at original} |
]]) ]])
feed('<Down>') feed('<Down>')
screen:expect([[ screen:expect([[
ug^ | ug^ |
{2:August } | {2:August }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) The only match} | {3:-- User defined completion (^U^N^P) The only match} |
]]) ]])
feed('<C-y>') feed('<C-y>')
screen:expect([[ screen:expect([[
August^ | August^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
expect('August') expect('August')
@@ -403,55 +405,55 @@ describe('completion', function()
screen:expect([[ screen:expect([[
| |
Ja^ | Ja^ |
{1:January } | {1:January }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{5:Back at original} | {3:-- User defined completion (^U^N^P) }{5:Back at original} |
]]) ]])
feed('<BS>') feed('<BS>')
screen:expect([[ screen:expect([[
| |
J^ | J^ |
{1:January } | {1:January }{0: }|
{1:June } | {1:June }{0: }|
{1:July } | {1:July }{0: }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{5:Back at original} | {3:-- User defined completion (^U^N^P) }{5:Back at original} |
]]) ]])
feed('<C-n>') feed('<C-n>')
screen:expect([[ screen:expect([[
| |
January^ | January^ |
{2:January } | {2:January }{0: }|
{1:June } | {1:June }{0: }|
{1:July } | {1:July }{0: }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{4:match 1 of 3} | {3:-- User defined completion (^U^N^P) }{4:match 1 of 3} |
]]) ]])
feed('<C-n>') feed('<C-n>')
screen:expect([[ screen:expect([[
| |
June^ | June^ |
{1:January } | {1:January }{0: }|
{2:June } | {2:June }{0: }|
{1:July } | {1:July }{0: }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- User defined completion (^U^N^P) }{4:match 2 of 3} | {3:-- User defined completion (^U^N^P) }{4:match 2 of 3} |
]]) ]])
feed('<Esc>') feed('<Esc>')
screen:expect([[ screen:expect([[
| |
Jun^e | Jun^e |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
feed('.') feed('.')
@@ -459,10 +461,10 @@ describe('completion', function()
| |
June | June |
Jun^e | Jun^e |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
expect([[ expect([[
@@ -487,45 +489,45 @@ describe('completion', function()
feed('i<C-r>=TestComplete()<CR>') feed('i<C-r>=TestComplete()<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:0 }{6: } | {1:0 }{6: }{0: }|
{1:1 }{2: } | {1:1 }{2: }{0: }|
{1:2 }{2: } | {1:2 }{2: }{0: }|
{1:3 }{2: } | {1:3 }{2: }{0: }|
{1:4 }{2: } | {1:4 }{2: }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('7') feed('7')
screen:expect([[ screen:expect([[
7^ | 7^ |
{1:7 }{6: } | {1:7 }{6: }{0: }|
{1:70 }{6: } | {1:70 }{6: }{0: }|
{1:71 }{6: } | {1:71 }{6: }{0: }|
{1:72 }{2: } | {1:72 }{2: }{0: }|
{1:73 }{2: } | {1:73 }{2: }{0: }|
{1:74 }{2: } | {1:74 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<c-n>') feed('<c-n>')
screen:expect([[ screen:expect([[
7^ | 7^ |
{2:7 }{6: } | {2:7 }{6: }{0: }|
{1:70 }{6: } | {1:70 }{6: }{0: }|
{1:71 }{6: } | {1:71 }{6: }{0: }|
{1:72 }{2: } | {1:72 }{2: }{0: }|
{1:73 }{2: } | {1:73 }{2: }{0: }|
{1:74 }{2: } | {1:74 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<c-n>') feed('<c-n>')
screen:expect([[ screen:expect([[
70^ | 70^ |
{1:7 }{6: } | {1:7 }{6: }{0: }|
{2:70 }{6: } | {2:70 }{6: }{0: }|
{1:71 }{6: } | {1:71 }{6: }{0: }|
{1:72 }{2: } | {1:72 }{2: }{0: }|
{1:73 }{2: } | {1:73 }{2: }{0: }|
{1:74 }{2: } | {1:74 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
end) end)
@@ -534,111 +536,111 @@ describe('completion', function()
feed('i<C-r>=TestComplete()<CR>') feed('i<C-r>=TestComplete()<CR>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:0 }{6: } | {1:0 }{6: }{0: }|
{1:1 }{2: } | {1:1 }{2: }{0: }|
{1:2 }{2: } | {1:2 }{2: }{0: }|
{1:3 }{2: } | {1:3 }{2: }{0: }|
{1:4 }{2: } | {1:4 }{2: }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageDown>') feed('<PageDown>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:0 }{6: } | {1:0 }{6: }{0: }|
{1:1 }{2: } | {1:1 }{2: }{0: }|
{1:2 }{2: } | {1:2 }{2: }{0: }|
{2:3 } | {2:3 }{0: }|
{1:4 }{2: } | {1:4 }{2: }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageDown>') feed('<PageDown>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:5 }{6: } | {1:5 }{6: }{0: }|
{1:6 }{2: } | {1:6 }{2: }{0: }|
{2:7 } | {2:7 }{0: }|
{1:8 }{2: } | {1:8 }{2: }{0: }|
{1:9 }{2: } | {1:9 }{2: }{0: }|
{1:10 }{2: } | {1:10 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<Down>') feed('<Down>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:5 }{6: } | {1:5 }{6: }{0: }|
{1:6 }{2: } | {1:6 }{2: }{0: }|
{1:7 }{2: } | {1:7 }{2: }{0: }|
{2:8 } | {2:8 }{0: }|
{1:9 }{2: } | {1:9 }{2: }{0: }|
{1:10 }{2: } | {1:10 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageUp>') feed('<PageUp>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:2 }{6: } | {1:2 }{6: }{0: }|
{1:3 }{2: } | {1:3 }{2: }{0: }|
{2:4 } | {2:4 }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{1:6 }{2: } | {1:6 }{2: }{0: }|
{1:7 }{2: } | {1:7 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageUp>') -- stop on first item feed('<PageUp>') -- stop on first item
screen:expect([[ screen:expect([[
^ | ^ |
{2:0 }{6: } | {2:0 }{6: }{0: }|
{1:1 }{2: } | {1:1 }{2: }{0: }|
{1:2 }{2: } | {1:2 }{2: }{0: }|
{1:3 }{2: } | {1:3 }{2: }{0: }|
{1:4 }{2: } | {1:4 }{2: }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageUp>') -- when on first item, unselect feed('<PageUp>') -- when on first item, unselect
screen:expect([[ screen:expect([[
^ | ^ |
{1:0 }{6: } | {1:0 }{6: }{0: }|
{1:1 }{2: } | {1:1 }{2: }{0: }|
{1:2 }{2: } | {1:2 }{2: }{0: }|
{1:3 }{2: } | {1:3 }{2: }{0: }|
{1:4 }{2: } | {1:4 }{2: }{0: }|
{1:5 }{2: } | {1:5 }{2: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageUp>') -- when unselected, select last item feed('<PageUp>') -- when unselected, select last item
screen:expect([[ screen:expect([[
^ | ^ |
{1:95 }{2: } | {1:95 }{2: }{0: }|
{1:96 }{2: } | {1:96 }{2: }{0: }|
{1:97 }{2: } | {1:97 }{2: }{0: }|
{1:98 }{2: } | {1:98 }{2: }{0: }|
{1:99 }{2: } | {1:99 }{2: }{0: }|
{2:100 }{6: } | {2:100 }{6: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<PageUp>') feed('<PageUp>')
screen:expect([[ screen:expect([[
^ | ^ |
{1:94 }{2: } | {1:94 }{2: }{0: }|
{1:95 }{2: } | {1:95 }{2: }{0: }|
{2:96 } | {2:96 }{0: }|
{1:97 }{2: } | {1:97 }{2: }{0: }|
{1:98 }{2: } | {1:98 }{2: }{0: }|
{1:99 }{6: } | {1:99 }{6: }{0: }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
feed('<cr>') feed('<cr>')
screen:expect([[ screen:expect([[
96^ | 96^ |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- INSERT --} | {3:-- INSERT --} |
]]) ]])
end) end)
@@ -651,22 +653,22 @@ describe('completion', function()
screen:expect([[ screen:expect([[
^foo | ^foo |
bar | bar |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
| |
]]) ]])
feed('A<C-x><C-l>') feed('A<C-x><C-l>')
screen:expect([[ screen:expect([[
foo^ | foo^ |
bar | bar |
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Whole line completion (^L^N^P) }{7:Pattern not found} | {3:-- Whole line completion (^L^N^P) }{7:Pattern not found} |
]]) ]])
eq(-1, eval('foldclosed(1)')) eq(-1, eval('foldclosed(1)'))
@@ -679,11 +681,11 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foobar fooegg | foobar fooegg |
fooegg^ | fooegg^ |
{1:foobar } | {1:foobar }{0: }|
{2:fooegg } | {2:fooegg }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword completion (^N^P) }{4:match 1 of 2} | {3:-- Keyword completion (^N^P) }{4:match 1 of 2} |
]]) ]])
@@ -692,11 +694,11 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foobar fooegg | foobar fooegg |
fooegg^ | fooegg^ |
{1:foobar } | {1:foobar }{0: }|
{2:fooegg } | {2:fooegg }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword completion (^N^P) }{4:match 1 of 2} | {3:-- Keyword completion (^N^P) }{4:match 1 of 2} |
]]) ]])
@@ -705,11 +707,11 @@ describe('completion', function()
screen:expect([[ screen:expect([[
foobar fooegg | foobar fooegg |
foobar^ | foobar^ |
{2:foobar } | {2:foobar }{0: }|
{1:fooegg } | {1:fooegg }{0: }|
~ | {0:~ }|
~ | {0:~ }|
~ | {0:~ }|
{3:-- Keyword completion (^N^P) }{4:match 2 of 2} | {3:-- Keyword completion (^N^P) }{4:match 2 of 2} |
]]) ]])
end) end)
@@ -722,43 +724,35 @@ describe('completion', function()
screen:expect([[ screen:expect([[
| |
{8:[No Name] }| {8:[No Name] }|
:foo faa fee f^ | {0::}foo faa fee f^ |
:~ | {0::~ }|
:~ | {0::~ }|
:~ | {0::~ }|
{9:[Command Line] }| {9:[Command Line] }|
{3:-- INSERT --} | {3:-- INSERT --} |
]], {[3] = {bold = true}, ]] )
[4] = {bold = true, foreground = Screen.colors.SeaGreen},
[8] = {reverse = true},
[9] = {bold = true, reverse = true}})
feed('<c-x><c-n>') feed('<c-x><c-n>')
screen:expect([[ screen:expect([[
| |
{8:[No Name] }| {8:[No Name] }|
:foo faa fee foo^ | {0::}foo faa fee foo^ |
:~ {2: foo } | {0::~ }{2: foo }{0: }|
:~ {1: faa } | {0::~ }{1: faa }{0: }|
:~ {1: fee } | {0::~ }{1: fee }{0: }|
{9:[Command Line] }| {9:[Command Line] }|
{3:-- Keyword Local completion (^N^P) }{4:match 1 of 3} | {3:-- Keyword Local completion (^N^P) }{4:match 1 of 3} |
]],{[1] = {background = Screen.colors.LightMagenta}, ]])
[2] = {background = Screen.colors.Grey},
[3] = {bold = true},
[4] = {bold = true, foreground = Screen.colors.SeaGreen},
[8] = {reverse = true},
[9] = {bold = true, reverse = true}})
feed('<c-c>') feed('<c-c>')
screen:expect([[ screen:expect([[
| |
{8:[No Name] }| {8:[No Name] }|
:foo faa fee foo | {0::}foo faa fee foo |
:~ | {0::~ }|
:~ | {0::~ }|
:~ | {0::~ }|
{9:[Command Line] }| {9:[Command Line] }|
:foo faa fee foo^ | :foo faa fee foo^ |
]], {[8] = {reverse = true}, [9] = {bold = true, reverse = true}}) ]])
end) end)
end) end)
end) end)