aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/window_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/api/window_spec.lua')
-rw-r--r--test/functional/api/window_spec.lua77
1 files changed, 76 insertions, 1 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 7c65cf9c37..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
@@ -229,6 +230,46 @@ describe('API/win', function()
|
]])
end)
+
+ it('updates cursorcolumn in non-current window', function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {background = Screen.colors.Grey90}, -- CursorColumn
+ [3] = {bold = true, reverse = true}, -- StatusLine
+ [4] = {reverse = true}, -- StatusLineNC
+ })
+ screen:attach()
+ command('set cursorcolumn')
+ insert([[
+ aaa
+ bbb
+ ccc
+ ddd]])
+ local oldwin = curwin()
+ command('vsplit')
+ screen:expect([[
+ aa{2:a} │aa{2:a} |
+ bb{2:b} │bb{2:b} |
+ cc{2:c} │cc{2:c} |
+ dd^d │ddd |
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ |
+ ]])
+ window('set_cursor', oldwin, {2, 0})
+ screen:expect([[
+ aa{2:a} │{2:a}aa |
+ bb{2:b} │bbb |
+ cc{2:c} │{2:c}cc |
+ dd^d │{2:d}dd |
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ |
+ ]])
+ end)
end)
describe('{get,set}_height', function()
@@ -243,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()
@@ -257,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()
@@ -450,6 +523,8 @@ describe('API/win', function()
it('closing current (float) window of another tabpage #15313', function()
command('tabedit')
+ command('botright split')
+ local prevwin = curwin().id
eq(2, eval('tabpagenr()'))
local win = meths.open_win(0, true, {
relative='editor', row=10, col=10, width=50, height=10
@@ -459,7 +534,7 @@ describe('API/win', function()
eq(1, eval('tabpagenr()'))
meths.win_close(win, false)
- eq(1001, meths.tabpage_get_win(tab).id)
+ eq(prevwin, meths.tabpage_get_win(tab).id)
assert_alive()
end)
end)