aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/window_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-10 20:13:40 +0800
committerGitHub <noreply@github.com>2022-12-10 20:13:40 +0800
commit224473546c95f17c45afc54fe8b4ef5f0e000974 (patch)
treefec868e826d41d56c556eb552c7fbde78d91cac9 /test/functional/api/window_spec.lua
parent6d37d8cb17390419360c1459607beac2d93183b6 (diff)
downloadrneovim-224473546c95f17c45afc54fe8b4ef5f0e000974.tar.gz
rneovim-224473546c95f17c45afc54fe8b4ef5f0e000974.tar.bz2
rneovim-224473546c95f17c45afc54fe8b4ef5f0e000974.zip
fix(api): set correct curbuf when temporarily changing curwin (#21371)
This is the same code change as https://github.com/vim/vim/commit/6c87bbb4e45515e70ac1728cabd1451063bf427d
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r--test/functional/api/window_spec.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 774ec406a8..ecab6a4713 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -7,6 +7,7 @@ local clear, nvim, curbuf, curbuf_contents, window, curwin, eq, neq,
helpers.tabpage
local poke_eventloop = helpers.poke_eventloop
local curwinmeths = helpers.curwinmeths
+local exec = helpers.exec
local funcs = helpers.funcs
local request = helpers.request
local NIL = helpers.NIL
@@ -283,6 +284,22 @@ describe('API/win', function()
window('set_height', nvim('list_wins')[2], 2)
eq(2, window('get_height', nvim('list_wins')[2]))
end)
+
+ it('do not cause ml_get errors with foldmethod=expr #19989', function()
+ insert([[
+ aaaaa
+ bbbbb
+ ccccc]])
+ command('set foldmethod=expr')
+ exec([[
+ new
+ let w = nvim_get_current_win()
+ wincmd w
+ call nvim_win_set_height(w, 5)
+ ]])
+ feed('l')
+ eq('', meths.get_vvar('errmsg'))
+ end)
end)
describe('{get,set}_width', function()
@@ -297,6 +314,22 @@ describe('API/win', function()
window('set_width', nvim('list_wins')[2], 2)
eq(2, window('get_width', nvim('list_wins')[2]))
end)
+
+ it('do not cause ml_get errors with foldmethod=expr #19989', function()
+ insert([[
+ aaaaa
+ bbbbb
+ ccccc]])
+ command('set foldmethod=expr')
+ exec([[
+ vnew
+ let w = nvim_get_current_win()
+ wincmd w
+ call nvim_win_set_width(w, 5)
+ ]])
+ feed('l')
+ eq('', meths.get_vvar('errmsg'))
+ end)
end)
describe('{get,set,del}_var', function()