aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/api/vim_spec.lua43
-rw-r--r--test/functional/core/job_spec.lua26
-rw-r--r--test/functional/legacy/edit_spec.lua26
-rw-r--r--test/functional/legacy/messages_spec.lua402
-rw-r--r--test/functional/ui/options_spec.lua6
-rw-r--r--test/functional/ui/popupmenu_spec.lua91
-rw-r--r--test/functional/ui/statusline_spec.lua25
-rw-r--r--test/functional/vimscript/let_spec.lua17
8 files changed, 602 insertions, 34 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 989ed27e16..3724dbf820 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1469,6 +1469,17 @@ describe('API', function()
nvim('win_set_option', win, 'number', true)
eq(true, nvim('get_option_value', 'number', {win = win}))
end)
+
+ it('getting current buffer option does not adjust cursor #19381', function()
+ nvim('command', 'new')
+ local buf = nvim('get_current_buf').id
+ local win = nvim('get_current_win').id
+ insert('some text')
+ feed('0v$')
+ eq({1, 9}, nvim('win_get_cursor', win))
+ nvim('get_option_value', 'filetype', {buf = buf})
+ eq({1, 9}, nvim('win_get_cursor', win))
+ end)
end)
describe('nvim_{get,set}_current_buf, nvim_list_bufs', function()
@@ -3613,6 +3624,38 @@ describe('API', function()
eq('Error while parsing command line: E464: Ambiguous use of user-defined command',
pcall_err(meths.parse_cmd, 'F', {}))
end)
+ it('does not interfere with printing line in Ex mode #19400', function()
+ local screen = Screen.new(60, 7)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- MsgSeparator
+ })
+ screen:attach()
+ insert([[
+ foo
+ bar]])
+ feed('gQ1')
+ screen:expect([[
+ foo |
+ bar |
+ {0:~ }|
+ {0:~ }|
+ {1: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :1^ |
+ ]])
+ eq('Error while parsing command line', pcall_err(meths.parse_cmd, '', {}))
+ feed('<CR>')
+ screen:expect([[
+ foo |
+ bar |
+ {1: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :1 |
+ foo |
+ :^ |
+ ]])
+ end)
end)
describe('nvim_cmd', function()
it('works', function ()
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index a6763ba3c7..04fbb807be 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -73,9 +73,16 @@ describe('jobs', function()
nvim('command', [[call jobstart('echo $TOTO $VAR', g:job_opts)]])
end
- expect_msg_seq({
- {'notification', 'stdout', {0, {'hello world abc', ''}}},
- })
+ expect_msg_seq(
+ {
+ {'notification', 'stdout', {0, {'hello world abc'}}},
+ {'notification', 'stdout', {0, {'', ''}}},
+ },
+ {
+ {'notification', 'stdout', {0, {'hello world abc', ''}}},
+ {'notification', 'stdout', {0, {''}}}
+ }
+ )
end)
it('append environment with pty #env', function()
@@ -89,9 +96,16 @@ describe('jobs', function()
else
nvim('command', [[call jobstart('echo $TOTO $VAR', g:job_opts)]])
end
- expect_msg_seq({
- {'notification', 'stdout', {0, {'hello world abc', ''}}},
- })
+ expect_msg_seq(
+ {
+ {'notification', 'stdout', {0, {'hello world abc'}}},
+ {'notification', 'stdout', {0, {'', ''}}},
+ },
+ {
+ {'notification', 'stdout', {0, {'hello world abc', ''}}},
+ {'notification', 'stdout', {0, {''}}}
+ }
+ )
end)
it('replace environment #env', function()
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
new file mode 100644
index 0000000000..7fc5f11a79
--- /dev/null
+++ b/test/functional/legacy/edit_spec.lua
@@ -0,0 +1,26 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local command = helpers.command
+local expect = helpers.expect
+local feed = helpers.feed
+local sleep = helpers.sleep
+
+before_each(clear)
+
+-- oldtest: Test_autoindent_remove_indent()
+it('autoindent removes indent when Insert mode is stopped', function()
+ command('set autoindent')
+ -- leaving insert mode in a new line with indent added by autoindent, should
+ -- remove the indent.
+ feed('i<Tab>foo<CR><Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ -- when a line is wrapped and the cursor is at the start of the second line,
+ -- leaving insert mode, should move the cursor back to the first line.
+ feed('o' .. ('x'):rep(20) .. '<Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ expect('\tfoo\n\n' .. ('x'):rep(20))
+end)
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index 34807a099c..b296ac909d 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -8,39 +8,389 @@ local feed = helpers.feed
before_each(clear)
describe('messages', function()
- it('more prompt with control characters can be quit vim-patch:8.2.1844', function()
- local screen = Screen.new(40, 6)
+ local screen
+
+ describe('more prompt', function()
+ before_each(function()
+ screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [2] = {foreground = Screen.colors.Brown}, -- LineNr
+ [3] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ })
+ screen:attach()
+ command('set more')
+ end)
+
+ -- oldtest: Test_message_more()
+ it('works', function()
+ command('call setline(1, range(1, 100))')
+
+ feed(':%p#\n')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More --}^ |
+ ]])
+
+ feed('?')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit }^ |
+ ]])
+
+ -- Down a line with j, <CR>, <NL> or <Down>.
+ feed('j')
+ screen:expect([[
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {2: 6 }6 |
+ {1:-- More --}^ |
+ ]])
+ feed('<NL>')
+ screen:expect([[
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {2: 6 }6 |
+ {2: 7 }7 |
+ {1:-- More --}^ |
+ ]])
+ feed('<CR>')
+ screen:expect([[
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {2: 6 }6 |
+ {2: 7 }7 |
+ {2: 8 }8 |
+ {1:-- More --}^ |
+ ]])
+ feed('<Down>')
+ screen:expect([[
+ {2: 5 }5 |
+ {2: 6 }6 |
+ {2: 7 }7 |
+ {2: 8 }8 |
+ {2: 9 }9 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Down a screen with <Space>, f, or <PageDown>.
+ feed('f')
+ screen:expect([[
+ {2: 10 }10 |
+ {2: 11 }11 |
+ {2: 12 }12 |
+ {2: 13 }13 |
+ {2: 14 }14 |
+ {1:-- More --}^ |
+ ]])
+ feed('<Space>')
+ screen:expect([[
+ {2: 15 }15 |
+ {2: 16 }16 |
+ {2: 17 }17 |
+ {2: 18 }18 |
+ {2: 19 }19 |
+ {1:-- More --}^ |
+ ]])
+ feed('<PageDown>')
+ screen:expect([[
+ {2: 20 }20 |
+ {2: 21 }21 |
+ {2: 22 }22 |
+ {2: 23 }23 |
+ {2: 24 }24 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Down a page (half a screen) with d.
+ feed('d')
+ screen:expect([[
+ {2: 23 }23 |
+ {2: 24 }24 |
+ {2: 25 }25 |
+ {2: 26 }26 |
+ {2: 27 }27 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Down all the way with 'G'.
+ feed('G')
+ screen:expect([[
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {2: 98 }98 |
+ {2: 99 }99 |
+ {2:100 }100 |
+ {1:Press ENTER or type command to continue}^ |
+ ]])
+
+ -- Up a line k, <BS> or <Up>.
+ feed('k')
+ screen:expect([[
+ {2: 95 }95 |
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {2: 98 }98 |
+ {2: 99 }99 |
+ {1:-- More --}^ |
+ ]])
+ feed('<BS>')
+ screen:expect([[
+ {2: 94 }94 |
+ {2: 95 }95 |
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {2: 98 }98 |
+ {1:-- More --}^ |
+ ]])
+ feed('<Up>')
+ screen:expect([[
+ {2: 93 }93 |
+ {2: 94 }94 |
+ {2: 95 }95 |
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Up a screen with b or <PageUp>.
+ feed('b')
+ screen:expect([[
+ {2: 88 }88 |
+ {2: 89 }89 |
+ {2: 90 }90 |
+ {2: 91 }91 |
+ {2: 92 }92 |
+ {1:-- More --}^ |
+ ]])
+ feed('<PageUp>')
+ screen:expect([[
+ {2: 83 }83 |
+ {2: 84 }84 |
+ {2: 85 }85 |
+ {2: 86 }86 |
+ {2: 87 }87 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Up a page (half a screen) with u.
+ feed('u')
+ screen:expect([[
+ {2: 80 }80 |
+ {2: 81 }81 |
+ {2: 82 }82 |
+ {2: 83 }83 |
+ {2: 84 }84 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Up all the way with 'g'.
+ feed('g')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More --}^ |
+ ]])
+
+ -- All the way down. Pressing f should do nothing but pressing
+ -- space should end the more prompt.
+ feed('G')
+ screen:expect([[
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {2: 98 }98 |
+ {2: 99 }99 |
+ {2:100 }100 |
+ {1:Press ENTER or type command to continue}^ |
+ ]])
+ feed('f')
+ screen:expect_unchanged()
+ feed('<Space>')
+ screen:expect([[
+ 96 |
+ 97 |
+ 98 |
+ 99 |
+ ^100 |
+ |
+ ]])
+
+ -- Pressing g< shows the previous command output.
+ feed('g<lt>')
+ screen:expect([[
+ {2: 96 }96 |
+ {2: 97 }97 |
+ {2: 98 }98 |
+ {2: 99 }99 |
+ {2:100 }100 |
+ {1:Press ENTER or type command to continue}^ |
+ ]])
+
+ feed(':%p#\n')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More --}^ |
+ ]])
+
+ -- Stop command output with q, <Esc> or CTRL-C.
+ feed('q')
+ screen:expect([[
+ 96 |
+ 97 |
+ 98 |
+ 99 |
+ ^100 |
+ |
+ ]])
+
+ -- Execute a : command from the more prompt
+ feed(':%p#\n')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More --}^ |
+ ]])
+ feed(':')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ :^ |
+ ]])
+ feed("echo 'Hello'\n")
+ screen:expect([[
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ Hello |
+ {1:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+
+ -- oldtest: Test_quit_long_message()
+ it('with control characters can be quit vim-patch:8.2.1844', function()
+ screen:try_resize(40, 6)
+ feed([[:echom range(9999)->join("\x01")<CR>]])
+ screen:expect([[
+ 0{3:^A}1{3:^A}2{3:^A}3{3:^A}4{3:^A}5{3:^A}6{3:^A}7{3:^A}8{3:^A}9{3:^A}10{3:^A}11{3:^A}12|
+ {3:^A}13{3:^A}14{3:^A}15{3:^A}16{3:^A}17{3:^A}18{3:^A}19{3:^A}20{3:^A}21{3:^A}22|
+ {3:^A}23{3:^A}24{3:^A}25{3:^A}26{3:^A}27{3:^A}28{3:^A}29{3:^A}30{3:^A}31{3:^A}32|
+ {3:^A}33{3:^A}34{3:^A}35{3:^A}36{3:^A}37{3:^A}38{3:^A}39{3:^A}40{3:^A}41{3:^A}42|
+ {3:^A}43{3:^A}44{3:^A}45{3:^A}46{3:^A}47{3:^A}48{3:^A}49{3:^A}50{3:^A}51{3:^A}52|
+ {1:-- More --}^ |
+ ]])
+ feed('q')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+ end)
+
+ -- oldtest: Test_ask_yesno()
+ it('y/n prompt works', function()
+ screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
- [2] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
- [3] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [2] = {bold = true, reverse = true}, -- MsgSeparator
})
screen:attach()
- command('set more')
- feed([[:echom range(9999)->join("\x01")<CR>]])
+ command('set noincsearch nohlsearch inccommand=')
+ command('call setline(1, range(1, 2))')
+
+ feed(':2,1s/^/n/\n')
+ screen:expect([[
+ 1 |
+ 2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}^ |
+ ]])
+ feed('n')
+ screen:expect([[
+ ^1 |
+ 2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}n |
+ ]])
+
+ feed(':2,1s/^/Esc/\n')
+ screen:expect([[
+ 1 |
+ 2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}^ |
+ ]])
+ feed('<Esc>')
+ screen:expect([[
+ ^1 |
+ 2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}n |
+ ]])
+
+ feed(':2,1s/^/y/\n')
screen:expect([[
- 0{1:^A}1{1:^A}2{1:^A}3{1:^A}4{1:^A}5{1:^A}6{1:^A}7{1:^A}8{1:^A}9{1:^A}10{1:^A}11{1:^A}12|
- {1:^A}13{1:^A}14{1:^A}15{1:^A}16{1:^A}17{1:^A}18{1:^A}19{1:^A}20{1:^A}21{1:^A}22|
- {1:^A}23{1:^A}24{1:^A}25{1:^A}26{1:^A}27{1:^A}28{1:^A}29{1:^A}30{1:^A}31{1:^A}32|
- {1:^A}33{1:^A}34{1:^A}35{1:^A}36{1:^A}37{1:^A}38{1:^A}39{1:^A}40{1:^A}41{1:^A}42|
- {1:^A}43{1:^A}44{1:^A}45{1:^A}46{1:^A}47{1:^A}48{1:^A}49{1:^A}50{1:^A}51{1:^A}52|
- {2:-- More --}^ |
+ 1 |
+ 2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}^ |
]])
- feed('q')
+ feed('y')
screen:expect([[
- ^ |
- {3:~ }|
- {3:~ }|
- {3:~ }|
- {3:~ }|
- |
+ y1 |
+ ^y2 |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:Backwards range given, OK to swap (y/n)?}y |
]])
end)
+ -- oldtest: Test_fileinfo_after_echo()
it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function()
- local screen = Screen.new(40, 6)
+ screen = Screen.new(40, 6)
screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
})
screen:attach()
exec([[
@@ -60,10 +410,10 @@ describe('messages', function()
feed('0$')
screen:expect([[
^hi |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
'b' written |
]])
os.remove('b.txt')
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index 82f856e4df..346a64c63b 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -87,6 +87,12 @@ describe('UI receives option updates', function()
eq(expected, screen.options)
end)
+ command("set pumblend=-1")
+ expected.pumblend = 0
+ screen:expect(function()
+ eq(expected, screen.options)
+ end)
+
command("set guifont=Comic\\ Sans")
expected.guifont = "Comic Sans"
screen:expect(function()
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 39753cca5b..0cd991756c 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -2427,6 +2427,34 @@ describe('builtin popupmenu', function()
:let g:menustr = 'baz' |
]])
eq('baz', meths.get_var('menustr'))
+ meths.input_mouse('right', 'press', '', 0, 0, 4)
+ screen:expect([[
+ ^popup menu test |
+ {1:~ }{n: foo }{1: }|
+ {1:~ }{n: bar }{1: }|
+ {1:~ }{n: baz }{1: }|
+ {1:~ }|
+ :let g:menustr = 'baz' |
+ ]])
+ meths.input_mouse('right', 'drag', '', 0, 3, 6)
+ screen:expect([[
+ ^popup menu test |
+ {1:~ }{n: foo }{1: }|
+ {1:~ }{n: bar }{1: }|
+ {1:~ }{s: baz }{1: }|
+ {1:~ }|
+ :let g:menustr = 'baz' |
+ ]])
+ meths.input_mouse('right', 'release', '', 0, 1, 6)
+ screen:expect([[
+ ^popup menu test |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :let g:menustr = 'foo' |
+ ]])
+ eq('foo', meths.get_var('menustr'))
end)
end)
@@ -2571,5 +2599,68 @@ describe('builtin popupmenu with ui/ext_multigrid', function()
:let g:menustr = 'baz' |
]]})
eq('baz', meths.get_var('menustr'))
+ meths.input_mouse('right', 'press', '', 2, 0, 4)
+ screen:expect({grid=[[
+ ## grid 1
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [3:--------------------------------]|
+ ## grid 2
+ ^popup menu test |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'baz' |
+ ## grid 4
+ {n: foo }|
+ {n: bar }|
+ {n: baz }|
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ meths.input_mouse('right', 'drag', '', 2, 3, 6)
+ screen:expect({grid=[[
+ ## grid 1
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [3:--------------------------------]|
+ ## grid 2
+ ^popup menu test |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'baz' |
+ ## grid 4
+ {n: foo }|
+ {n: bar }|
+ {s: baz }|
+ ]], float_pos={[4] = {{id = -1}, 'NW', 2, 1, 3, false, 100}}})
+ meths.input_mouse('right', 'release', '', 2, 1, 6)
+ screen:expect({grid=[[
+ ## grid 1
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ [3:--------------------------------]|
+ ## grid 2
+ ^popup menu test |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'foo' |
+ ]]})
+ eq('foo', meths.get_var('menustr'))
end)
end)
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 2733b9dd4a..82e669856f 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -20,7 +20,12 @@ describe('statusline clicks', function()
command('set laststatus=2')
exec([=[
function! MyClickFunc(minwid, clicks, button, mods)
- let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
+ let mods = trim(a:mods)
+ if mods ==# ''
+ let g:testvar = printf("%d %d %s", a:minwid, a:clicks, a:button)
+ else
+ let g:testvar = printf("%d %d %s %s", a:minwid, a:clicks, a:button, mods)
+ endif
endfunction
]=])
end)
@@ -37,7 +42,7 @@ describe('statusline clicks', 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, 6, 17)
+ meths.input_mouse('right', 'press', '', 0, 0, 17)
eq('0 1 r', eval("g:testvar"))
end)
@@ -84,6 +89,22 @@ describe('statusline clicks', function()
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("click works with modifiers #18994", function()
+ meths.set_option('statusline', 'Not clicky stuff %0@MyClickFunc@Clicky stuff%T')
+ meths.input_mouse('right', 'press', 's', 0, 6, 17)
+ eq('0 1 r s', eval("g:testvar"))
+ meths.input_mouse('left', 'press', 's', 0, 6, 17)
+ eq('0 1 l s', eval("g:testvar"))
+ end)
end)
describe('global statusline', function()
diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua
index 85c9c690f9..ca1b5e8907 100644
--- a/test/functional/vimscript/let_spec.lua
+++ b/test/functional/vimscript/let_spec.lua
@@ -5,6 +5,7 @@ local clear = helpers.clear
local command = helpers.command
local eval = helpers.eval
local meths = helpers.meths
+local exec = helpers.exec
local exec_capture = helpers.exec_capture
local source = helpers.source
local testprg = helpers.testprg
@@ -91,3 +92,19 @@ describe(':let', function()
eq(1, eval('1'))
end)
end)
+
+describe(':let and :const', function()
+ it('have the same output when called without arguments', function()
+ eq(exec_capture('let'), exec_capture('const'))
+ end)
+
+ it('can be used in sandbox', function()
+ exec([[
+ func Func()
+ let l:foo = 'foo'
+ const l:bar = 'bar'
+ endfunc
+ sandbox call Func()
+ ]])
+ end)
+end)