aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/mouse_spec.lua10
-rw-r--r--test/functional/ui/popupmenu_spec.lua18
-rw-r--r--test/functional/ui/statuscolumn_spec.lua82
-rw-r--r--test/functional/ui/statusline_spec.lua348
-rw-r--r--test/functional/vimscript/special_vars_spec.lua6
-rw-r--r--test/old/testdir/test_filetype.vim22
6 files changed, 255 insertions, 231 deletions
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index f705678bd5..c7f6861c12 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1840,16 +1840,6 @@ describe('ui/mouse/input', function()
eq({2, 9}, meths.win_get_cursor(0))
eq('', funcs.getreg('"'))
- -- Try clicking on the status line
- funcs.setreg('"', '')
- meths.win_set_cursor(0, {1, 9})
- feed('vee')
- meths.input_mouse('right', 'press', '', 0, 5, 1)
- meths.input_mouse('right', 'release', '', 0, 5, 1)
- feed('<Down><CR>')
- eq({1, 9}, meths.win_get_cursor(0))
- eq('ran away', funcs.getreg('"'))
-
-- Try clicking outside the window
funcs.setreg('"', '')
meths.win_set_cursor(0, {2, 1})
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index cfcf83ba42..53ef60bc89 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -3259,16 +3259,16 @@ describe('builtin popupmenu', function()
:let g:menustr = 'bar' |
]])
eq('bar', meths.get_var('menustr'))
- feed('<RightMouse><20,1>')
+ feed('<RightMouse><20,2>')
screen:expect([[
^popup menu test |
{1:~ }|
+ {1:~ }|
{1:~ }{n: foo }{1: }|
{1:~ }{n: bar }{1: }|
- {1:~ }{n: baz }{1: }|
- :let g:menustr = 'bar' |
+ :let g:menustr = 'b{n: baz } |
]])
- feed('<LeftMouse><22,4>')
+ feed('<LeftMouse><22,5>')
screen:expect([[
^popup menu test |
{1:~ }|
@@ -3675,7 +3675,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 2, 19, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 2, 19, false, 250}}})
meths.input_mouse('left', 'press', '', 4, 2, 2)
screen:expect({grid=[[
## grid 1
@@ -3716,7 +3716,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
meths.input_mouse('right', 'drag', '', 2, 3, 6)
screen:expect({grid=[[
## grid 1
@@ -3738,7 +3738,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
meths.input_mouse('right', 'release', '', 2, 1, 6)
screen:expect({grid=[[
## grid 1
@@ -3780,7 +3780,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{n: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
eq(true, screen.options.mousemoveevent)
meths.input_mouse('move', '', '', 2, 3, 6)
screen:expect({grid=[[
@@ -3803,7 +3803,7 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
{n: foo }|
{n: bar }|
{s: baz }|
- ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 250}}})
eq(true, screen.options.mousemoveevent)
meths.input_mouse('left', 'press', '', 2, 2, 6)
screen:expect({grid=[[
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index c4b055d289..3b41d3684a 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -9,6 +9,8 @@ local feed = helpers.feed
local meths = helpers.meths
local pcall_err = helpers.pcall_err
+local mousemodels = { "extend", "popup", "popup_setpos" }
+
describe('statuscolumn', function()
local screen
before_each(function()
@@ -420,45 +422,47 @@ describe('statuscolumn', function()
]])
end)
- it("works with 'statuscolumn' clicks", function()
- command('set mousemodel=extend')
- command([[
- function! MyClickFunc(minwid, clicks, button, mods)
- let g:testvar = printf("%d %d %s %d", a:minwid, a:clicks, a:button, getmousepos().line)
- if a:mods !=# ' '
- let g:testvar ..= '(' .. a:mods .. ')'
- endif
- endfunction
- set stc=%0@MyClickFunc@%=%l%T
- ]])
- meths.input_mouse('left', 'press', '', 0, 0, 0)
- eq('0 1 l 4', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 0, 0)
- eq('0 2 l 4', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 0, 0)
- eq('0 3 l 4', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 0, 0)
- eq('0 4 l 4', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 3, 0)
- eq('0 1 r 7', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 3, 0)
- eq('0 2 r 7', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 3, 0)
- eq('0 3 r 7', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 3, 0)
- eq('0 4 r 7', eval("g:testvar"))
- command('set laststatus=2 winbar=%f')
- command('let g:testvar=""')
- -- Check that winbar click doesn't register as statuscolumn click
- meths.input_mouse('right', 'press', '', 0, 0, 0)
- eq('', eval("g:testvar"))
- -- Check that statusline click doesn't register as statuscolumn click
- meths.input_mouse('right', 'press', '', 0, 12, 0)
- eq('', eval("g:testvar"))
- -- Check that cmdline click doesn't register as statuscolumn click
- meths.input_mouse('right', 'press', '', 0, 13, 0)
- eq('', eval("g:testvar"))
- end)
+ for _, model in ipairs(mousemodels) do
+ it("works with 'statuscolumn' clicks with mousemodel=" .. model, function()
+ command('set mousemodel=' .. model)
+ command([[
+ function! MyClickFunc(minwid, clicks, button, mods)
+ let g:testvar = printf("%d %d %s %d", a:minwid, a:clicks, a:button, getmousepos().line)
+ if a:mods !=# ' '
+ let g:testvar ..= '(' .. a:mods .. ')'
+ endif
+ endfunction
+ set stc=%0@MyClickFunc@%=%l%T
+ ]])
+ meths.input_mouse('left', 'press', '', 0, 0, 0)
+ eq('0 1 l 4', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 0, 0)
+ eq('0 2 l 4', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 0, 0)
+ eq('0 3 l 4', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 0, 0)
+ eq('0 4 l 4', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 3, 0)
+ eq('0 1 r 7', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 3, 0)
+ eq('0 2 r 7', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 3, 0)
+ eq('0 3 r 7', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 3, 0)
+ eq('0 4 r 7', eval("g:testvar"))
+ command('set laststatus=2 winbar=%f')
+ command('let g:testvar=""')
+ -- Check that winbar click doesn't register as statuscolumn click
+ meths.input_mouse('right', 'press', '', 0, 0, 0)
+ eq('', eval("g:testvar"))
+ -- Check that statusline click doesn't register as statuscolumn click
+ meths.input_mouse('right', 'press', '', 0, 12, 0)
+ eq('', eval("g:testvar"))
+ -- Check that cmdline click doesn't register as statuscolumn click
+ meths.input_mouse('right', 'press', '', 0, 13, 0)
+ eq('', eval("g:testvar"))
+ end)
+ end
it('click labels do not leak memory', function()
command([[
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index c41d4983a7..5ea4eade4e 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -12,178 +12,182 @@ local exec_lua = helpers.exec_lua
local eval = helpers.eval
local sleep = helpers.sleep
-describe('statusline clicks', function()
- local screen
-
- before_each(function()
- clear()
- screen = Screen.new(40, 8)
- screen:attach()
- command('set laststatus=2 mousemodel=extend')
- exec([=[
- function! MyClickFunc(minwid, clicks, button, mods)
- let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
- if a:mods !=# ' '
- let g:testvar ..= '(' .. a:mods .. ')'
- endif
- endfunction
- ]=])
- end)
-
- it('works', function()
- meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 2 l', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 3 l', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 4 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 1 r', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 2 r', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 3 r', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 4 r', eval("g:testvar"))
- end)
-
- it('works for winbar', function()
- meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.input_mouse('left', 'press', '', 0, 0, 17)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 0, 17)
- eq('0 1 r', eval("g:testvar"))
- end)
-
- it('works for winbar in floating window', function()
- meths.open_win(0, true, { width=30, height=4, relative='editor', row=1, col=5,
- border = "single" })
- meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T',
- { scope = 'local' })
- meths.input_mouse('left', 'press', '', 0, 2, 23)
- eq('0 1 l', eval("g:testvar"))
- end)
-
- it('works when there are multiple windows', function()
- command('split')
- meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.input_mouse('left', 'press', '', 0, 0, 17)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 4, 17)
- eq('0 1 r', eval("g:testvar"))
- meths.input_mouse('middle', 'press', '', 0, 3, 17)
- eq('0 1 m', eval("g:testvar"))
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 1 l', eval("g:testvar"))
- end)
-
- it('works with Lua function', function()
- exec_lua([[
- function clicky_func(minwid, clicks, button, mods)
- vim.g.testvar = string.format("%d %d %s", minwid, clicks, button)
- end
- ]])
- meths.set_option('statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T')
- meths.input_mouse('left', 'press', '', 0, 6, 17)
- eq('0 1 l', eval("g:testvar"))
- end)
-
- it('ignores unsupported click items', function()
- command('tabnew | tabprevious')
- meths.set_option('statusline', '%2TNot clicky stuff%T')
- meths.input_mouse('left', 'press', '', 0, 6, 0)
- eq(1, meths.get_current_tabpage().id)
- meths.set_option('statusline', '%2XNot clicky stuff%X')
- meths.input_mouse('left', 'press', '', 0, 6, 0)
- eq(2, #meths.list_tabpages())
- end)
-
- it("right click works when statusline isn't focused #18994", function()
- meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 1 r', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 17)
- eq('0 2 r', eval("g:testvar"))
- end)
-
- it("works with modifiers #18994", function()
- meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
- -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks
- meths.input_mouse('left', 'press', 'S', 0, 6, 17)
- eq('0 1 l(s )', eval("g:testvar"))
- meths.input_mouse('right', 'press', 'S', 0, 6, 17)
- eq('0 1 r(s )', eval("g:testvar"))
- meths.input_mouse('left', 'press', 'A', 0, 6, 17)
- eq('0 1 l( a )', eval("g:testvar"))
- meths.input_mouse('right', 'press', 'A', 0, 6, 17)
- eq('0 1 r( a )', eval("g:testvar"))
- meths.input_mouse('left', 'press', 'AS', 0, 6, 17)
- eq('0 1 l(s a )', eval("g:testvar"))
- meths.input_mouse('right', 'press', 'AS', 0, 6, 17)
- eq('0 1 r(s a )', eval("g:testvar"))
- meths.input_mouse('left', 'press', 'T', 0, 6, 17)
- eq('0 1 l( m)', eval("g:testvar"))
- meths.input_mouse('right', 'press', 'T', 0, 6, 17)
- eq('0 1 r( m)', eval("g:testvar"))
- meths.input_mouse('left', 'press', 'TS', 0, 6, 17)
- eq('0 1 l(s m)', eval("g:testvar"))
- meths.input_mouse('right', 'press', 'TS', 0, 6, 17)
- eq('0 1 r(s m)', eval("g:testvar"))
- meths.input_mouse('left', 'press', 'C', 0, 6, 17)
- eq('0 1 l( c )', eval("g:testvar"))
- -- <C-RightMouse> is for tag jump
- end)
-
- it("works for global statusline with vertical splits #19186", function()
- command('set laststatus=3')
- meths.set_option('statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T')
- command('vsplit')
- screen:expect([[
- ^ │ |
- ~ │~ |
- ~ │~ |
- ~ │~ |
- ~ │~ |
- ~ │~ |
- Clicky stuff Clicky stuff|
- |
- ]])
-
- -- clickable area on the right
- meths.input_mouse('left', 'press', '', 0, 6, 35)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 35)
- eq('0 1 r', eval("g:testvar"))
-
- -- clickable area on the left
- meths.input_mouse('left', 'press', '', 0, 6, 5)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 5)
- eq('0 1 r', eval("g:testvar"))
- end)
-
- it('no memory leak with zero-width click labels', function()
- command([[
- let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@'
- ]])
- meths.input_mouse('left', 'press', '', 0, 6, 0)
- eq('0 1 l', eval("g:testvar"))
- meths.input_mouse('right', 'press', '', 0, 6, 39)
- eq('0 1 r', eval("g:testvar"))
- end)
-
- it('no memory leak with truncated click labels', function()
- command([[
- let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz'
- ]])
- meths.input_mouse('left', 'press', '', 0, 6, 2)
- eq('0 1 l', eval("g:testvar"))
- end)
-end)
+local mousemodels = { "extend", "popup", "popup_setpos" }
+
+for _, model in ipairs(mousemodels) do
+ describe('statusline clicks with mousemodel=' .. model, function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(40, 8)
+ screen:attach()
+ command('set laststatus=2 mousemodel=' .. model)
+ exec([=[
+ function! MyClickFunc(minwid, clicks, button, mods)
+ let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
+ if a:mods !=# ' '
+ let g:testvar ..= '(' .. a:mods .. ')'
+ endif
+ endfunction
+ ]=])
+ end)
+
+ it('works', function()
+ meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 2 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 3 l', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 4 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 1 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 2 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 3 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 4 r', eval("g:testvar"))
+ end)
+
+ it('works for winbar', function()
+ meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.input_mouse('left', 'press', '', 0, 0, 17)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 0, 17)
+ eq('0 1 r', eval("g:testvar"))
+ end)
+
+ it('works for winbar in floating window', function()
+ meths.open_win(0, true, { width=30, height=4, relative='editor', row=1, col=5,
+ border = "single" })
+ meths.set_option_value('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T',
+ { scope = 'local' })
+ meths.input_mouse('left', 'press', '', 0, 2, 23)
+ eq('0 1 l', eval("g:testvar"))
+ end)
+
+ it('works when there are multiple windows', function()
+ command('split')
+ meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.set_option('winbar', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.input_mouse('left', 'press', '', 0, 0, 17)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 4, 17)
+ eq('0 1 r', eval("g:testvar"))
+ meths.input_mouse('middle', 'press', '', 0, 3, 17)
+ eq('0 1 m', eval("g:testvar"))
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 1 l', eval("g:testvar"))
+ end)
+
+ it('works with Lua function', function()
+ exec_lua([[
+ function clicky_func(minwid, clicks, button, mods)
+ vim.g.testvar = string.format("%d %d %s", minwid, clicks, button)
+ end
+ ]])
+ meths.set_option('statusline', 'Not clicky stuff %0@v:lua.clicky_func@Clicky stuff%T')
+ meths.input_mouse('left', 'press', '', 0, 6, 17)
+ eq('0 1 l', eval("g:testvar"))
+ end)
+
+ it('ignores unsupported click items', function()
+ command('tabnew | tabprevious')
+ meths.set_option('statusline', '%2TNot clicky stuff%T')
+ meths.input_mouse('left', 'press', '', 0, 6, 0)
+ eq(1, meths.get_current_tabpage().id)
+ meths.set_option('statusline', '%2XNot clicky stuff%X')
+ meths.input_mouse('left', 'press', '', 0, 6, 0)
+ eq(2, #meths.list_tabpages())
+ end)
+
+ it("right click works when statusline isn't focused #18994", function()
+ meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 1 r', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 17)
+ eq('0 2 r', eval("g:testvar"))
+ end)
+
+ it("works with modifiers #18994", function()
+ meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ -- Note: alternate between left and right mouse buttons to avoid triggering multiclicks
+ meths.input_mouse('left', 'press', 'S', 0, 6, 17)
+ eq('0 1 l(s )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'S', 0, 6, 17)
+ eq('0 1 r(s )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'A', 0, 6, 17)
+ eq('0 1 l( a )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'A', 0, 6, 17)
+ eq('0 1 r( a )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'AS', 0, 6, 17)
+ eq('0 1 l(s a )', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'AS', 0, 6, 17)
+ eq('0 1 r(s a )', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'T', 0, 6, 17)
+ eq('0 1 l( m)', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'T', 0, 6, 17)
+ eq('0 1 r( m)', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'TS', 0, 6, 17)
+ eq('0 1 l(s m)', eval("g:testvar"))
+ meths.input_mouse('right', 'press', 'TS', 0, 6, 17)
+ eq('0 1 r(s m)', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 'C', 0, 6, 17)
+ eq('0 1 l( c )', eval("g:testvar"))
+ -- <C-RightMouse> is for tag jump
+ end)
+
+ it("works for global statusline with vertical splits #19186", function()
+ command('set laststatus=3')
+ meths.set_option('statusline', '%0@MyClickFunc@Clicky stuff%T %= %0@MyClickFunc@Clicky stuff%T')
+ command('vsplit')
+ screen:expect([[
+ ^ │ |
+ ~ │~ |
+ ~ │~ |
+ ~ │~ |
+ ~ │~ |
+ ~ │~ |
+ Clicky stuff Clicky stuff|
+ |
+ ]])
+
+ -- clickable area on the right
+ meths.input_mouse('left', 'press', '', 0, 6, 35)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 35)
+ eq('0 1 r', eval("g:testvar"))
+
+ -- clickable area on the left
+ meths.input_mouse('left', 'press', '', 0, 6, 5)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 5)
+ eq('0 1 r', eval("g:testvar"))
+ end)
+
+ it('no memory leak with zero-width click labels', function()
+ command([[
+ let &stl = '%@Test@%T%@MyClickFunc@%=%T%@Test@'
+ ]])
+ meths.input_mouse('left', 'press', '', 0, 6, 0)
+ eq('0 1 l', eval("g:testvar"))
+ meths.input_mouse('right', 'press', '', 0, 6, 39)
+ eq('0 1 r', eval("g:testvar"))
+ end)
+
+ it('no memory leak with truncated click labels', function()
+ command([[
+ let &stl = '%@MyClickFunc@foo%X' .. repeat('a', 40) .. '%<t%@Test@bar%X%@Test@baz'
+ ]])
+ meths.input_mouse('left', 'press', '', 0, 6, 2)
+ eq('0 1 l', eval("g:testvar"))
+ end)
+ end)
+end
describe('global statusline', function()
local screen
diff --git a/test/functional/vimscript/special_vars_spec.lua b/test/functional/vimscript/special_vars_spec.lua
index 14ccbc3827..217f0b2c2b 100644
--- a/test/functional/vimscript/special_vars_spec.lua
+++ b/test/functional/vimscript/special_vars_spec.lua
@@ -130,6 +130,12 @@ describe('Special values', function()
eq("v:false", eval('"" . v:false'))
end)
+ it('work with ?? (falsy operator)', function()
+ eq(true, eval('v:true ?? 42'))
+ eq(42, eval('v:false ?? 42'))
+ eq(42, eval('v:null ?? 42'))
+ end)
+
it('work with type()', function()
eq(6, funcs.type(true))
eq(6, funcs.type(false))
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 42b80ba868..789430fc84 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -646,7 +646,6 @@ let s:filename_checks = {
\ 'vdmrt': ['file.vdmrt'],
\ 'vdmsl': ['file.vdm', 'file.vdmsl'],
\ 'vera': ['file.vr', 'file.vri', 'file.vrh'],
- \ 'verilog': ['file.v'],
\ 'verilogams': ['file.va', 'file.vams'],
\ 'vgrindefs': ['vgrindefs'],
\ 'vhdl': ['file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst', 'file.vhdl_123', 'file.vho', 'some.vhdl_1', 'some.vhdl_1-file'],
@@ -1771,6 +1770,27 @@ func Test_ttl_file()
filetype off
endfunc
+func Test_v_file()
+ filetype on
+
+ call writefile(['module tb; // Looks like a Verilog'], 'Xfile.v', 'D')
+ split Xfile.v
+ call assert_equal('verilog', &filetype)
+ bwipe!
+
+ call writefile(['module main'], 'Xfile.v')
+ split Xfile.v
+ call assert_equal('v', &filetype)
+ bwipe!
+
+ call writefile(['Definition x := 10. (*'], 'Xfile.v')
+ split Xfile.v
+ call assert_equal('coq', &filetype)
+ bwipe!
+
+ filetype off
+endfunc
+
func Test_xpm_file()
filetype on