aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-16 17:30:39 +0800
committerGitHub <noreply@github.com>2022-08-16 17:30:39 +0800
commit03fddfd92887bbac920d80cd9e04f28f32843f5d (patch)
tree57de450593501bed498f6b7b22d74a647db8a445 /test/functional/api/vim_spec.lua
parentdee96f4725da8f05d5b62fa08a4daf802d780813 (diff)
downloadrneovim-03fddfd92887bbac920d80cd9e04f28f32843f5d.tar.gz
rneovim-03fddfd92887bbac920d80cd9e04f28f32843f5d.tar.bz2
rneovim-03fddfd92887bbac920d80cd9e04f28f32843f5d.zip
fix(api): nvim_exec and nvim_cmd restore msg_col when capturing output (#19789)
This matches the code in execute_common(), preventing messages after the API call from being printed at the wrong column.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua48
1 files changed, 45 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 3338fc6538..72a03c409a 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -281,8 +281,8 @@ describe('API', function()
]]}
end)
- it('does\'t display messages when output=true', function()
- local screen = Screen.new(40, 8)
+ it('doesn\'t display messages when output=true', function()
+ local screen = Screen.new(40, 6)
screen:attach()
screen:set_default_attr_ids({
[0] = {bold=true, foreground=Screen.colors.Blue},
@@ -294,9 +294,21 @@ describe('API', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ |
+ ]]}
+ exec([[
+ func Print()
+ call nvim_exec('echo "hello"', v:true)
+ endfunc
+ ]])
+ feed([[:echon 1 | call Print() | echon 5<CR>]])
+ screen:expect{grid=[[
+ ^ |
{0:~ }|
{0:~ }|
- |
+ {0:~ }|
+ {0:~ }|
+ 15 |
]]}
end)
end)
@@ -3836,5 +3848,35 @@ describe('API', function()
meths.cmd({ cmd = 'make', args = { 'foo', 'bar' } }, {})
assert_alive()
end)
+ it('doesn\'t display messages when output=true', function()
+ local screen = Screen.new(40, 6)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ })
+ meths.cmd({cmd = 'echo', args = {[['hello']]}}, {output = true})
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ exec([[
+ func Print()
+ call nvim_cmd(#{cmd: 'echo', args: ['"hello"']}, #{output: v:true})
+ endfunc
+ ]])
+ feed([[:echon 1 | call Print() | echon 5<CR>]])
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 15 |
+ ]]}
+ end)
end)
end)