aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/ui/float_spec.lua
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua40
1 files changed, 27 insertions, 13 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 9b77cb4014..57ef9bcff6 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -640,8 +640,7 @@ describe('float window', function()
end)
it('tp_curwin updated if external window is moved into split', function()
- local screen = Screen.new(20, 7)
- screen:attach { ext_multigrid = true }
+ local _ = Screen.new(20, 7, { ext_multigrid = true })
command('tabnew')
local external_win = api.nvim_open_win(0, true, {external = true, width = 5, height = 5})
@@ -658,8 +657,6 @@ describe('float window', function()
command('tabnext')
eq(2, fn.tabpagenr())
neq(external_win, api.nvim_get_current_win())
-
- screen:detach()
end)
it('no crash with relative="win" after %bdelete #30569', function()
@@ -1018,8 +1015,7 @@ describe('float window', function()
local function with_ext_multigrid(multigrid)
local screen, attrs
before_each(function()
- screen = Screen.new(40,7)
- screen:attach {ext_multigrid=multigrid}
+ screen = Screen.new(40,7, {ext_multigrid=multigrid})
attrs = {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.LightMagenta},
@@ -1278,7 +1274,7 @@ describe('float window', function()
it('return their configuration', function()
local buf = api.nvim_create_buf(false, false)
local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60})
- local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
+ local expected = {anchor='NW', col=5, external=false, focusable=true, mouse=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
eq(expected, api.nvim_win_get_config(win))
eq(true, exec_lua([[
local expected, win = ...
@@ -1290,11 +1286,11 @@ describe('float window', function()
end
return true]], expected, win))
- eq({external=false, focusable=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0))
+ eq({external=false, focusable=true, mouse=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0))
if multigrid then
api.nvim_win_set_config(win, {external=true, width=10, height=1})
- eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win))
+ eq({external=true,focusable=true,mouse=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win))
end
end)
@@ -3988,7 +3984,7 @@ describe('float window', function()
]]}
end
eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false,
- external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win))
+ external=false, col=0, row=1, win=firstwin, focusable=true, mouse=true, zindex=50}, api.nvim_win_get_config(win))
feed('<c-e>')
if multigrid then
@@ -5606,7 +5602,7 @@ describe('float window', function()
end
end)
- it("focus by mouse", function()
+ local function test_float_mouse_focus()
if multigrid then
api.nvim_input_mouse('left', 'press', '', 4, 0, 0)
screen:expect{grid=[[
@@ -5660,10 +5656,18 @@ describe('float window', function()
|
]])
end
+ end
+
+ it("focus by mouse (focusable=true)", function()
+ test_float_mouse_focus()
end)
- it("focus by mouse (focusable=false)", function()
- api.nvim_win_set_config(win, {focusable=false})
+ it("focus by mouse (focusable=false, mouse=true)", function()
+ api.nvim_win_set_config(win, {focusable=false, mouse=true})
+ test_float_mouse_focus()
+ end)
+
+ local function test_float_mouse_no_focus()
api.nvim_buf_set_lines(0, -1, -1, true, {"a"})
expected_pos[4][6] = false
if multigrid then
@@ -5721,6 +5725,16 @@ describe('float window', function()
|
]])
end
+ end
+
+ it("focus by mouse (focusable=false)", function()
+ api.nvim_win_set_config(win, {focusable=false})
+ test_float_mouse_no_focus()
+ end)
+
+ it("focus by mouse (focusable=true, mouse=false)", function()
+ api.nvim_win_set_config(win, {mouse=false})
+ test_float_mouse_no_focus()
end)
it("j", function()