aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authornotomo <notomo.motono@gmail.com>2021-06-04 09:47:43 +0900
committerBjörn Linse <bjorn.linse@gmail.com>2021-06-10 09:34:29 +0200
commit1a9eb7a987d9fd45b56ed52b3a1c4f756ecd82a6 (patch)
treee1544de780be143f46fb230ab42a47e44ae0a250 /test/functional/lua/vim_spec.lua
parentfd7e77b2277d884c51bc6f0bd70c0e6e7a307bc1 (diff)
downloadrneovim-1a9eb7a987d9fd45b56ed52b3a1c4f756ecd82a6.tar.gz
rneovim-1a9eb7a987d9fd45b56ed52b3a1c4f756ecd82a6.tar.bz2
rneovim-1a9eb7a987d9fd45b56ed52b3a1c4f756ecd82a6.zip
api: add nvim_win_call
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 08a0552a38..836f514433 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -1931,6 +1931,34 @@ describe('lua stdlib', function()
eq(buf2, val)
end)
end)
+
+ describe('vim.api.nvim_win_call', function()
+ it('can access window options', function()
+ command('vsplit')
+ local win1 = meths.get_current_win()
+ command('wincmd w')
+ local win2 = exec_lua [[
+ win2 = vim.api.nvim_get_current_win()
+ return win2
+ ]]
+ command('wincmd p')
+
+ eq('', meths.win_get_option(win1, 'winhighlight'))
+ eq('', meths.win_get_option(win2, 'winhighlight'))
+
+ local val = exec_lua [[
+ return vim.api.nvim_win_call(win2, function()
+ vim.cmd "setlocal winhighlight=Normal:Normal"
+ return vim.api.nvim_get_current_win()
+ end)
+ ]]
+
+ eq('', meths.win_get_option(win1, 'winhighlight'))
+ eq('Normal:Normal', meths.win_get_option(win2, 'winhighlight'))
+ eq(win1, meths.get_current_win())
+ eq(win2, val)
+ end)
+ end)
end)
describe('lua: require("mod") from packages', function()