mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 02:08:17 +00:00
fix(window): skip unfocusable and hidden floats with "{count}<C-W>w" #33810
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can
enter unfocusable or hidden floating windows. This is especially problematic
when using the new in-development extui, which creates many unfocusable floats
for various UI elements.
Solution: Skip unfocusable and hidden floating windows. Instead, skip to the
next focusable, non-hidden window in the current tabpage's window list. Reword
the documentation a bit (hopefully an improvement?)
(cherry picked from commit 403fcacfc1
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
4e43264cd3
commit
9b3426691c
@@ -5632,6 +5632,59 @@ describe('float window', function()
|
||||
|
|
||||
]])
|
||||
end
|
||||
|
||||
api.nvim_open_win(
|
||||
0,
|
||||
false,
|
||||
{ relative = "editor", width = 1, height = 1, row = 0, col = 0 }
|
||||
)
|
||||
api.nvim_open_win(
|
||||
0,
|
||||
false,
|
||||
{ relative = "editor", width = 1, height = 1, row = 0, col = 0, focusable = false }
|
||||
)
|
||||
api.nvim_open_win(
|
||||
0,
|
||||
false,
|
||||
{ relative = "editor", width = 1, height = 1, row = 0, col = 0, focusable = false }
|
||||
)
|
||||
api.nvim_open_win(
|
||||
0,
|
||||
false,
|
||||
{ relative = "editor", width = 1, height = 1, row = 0, col = 0, focusable = true }
|
||||
)
|
||||
api.nvim_open_win(
|
||||
0,
|
||||
false,
|
||||
{ relative = "editor", width = 1, height = 1, row = 0, col = 0, focusable = false }
|
||||
)
|
||||
local nr_focusable = {}
|
||||
for nr = 1, fn.winnr("$") do
|
||||
table.insert(nr_focusable, api.nvim_win_get_config(fn.win_getid(nr)).focusable)
|
||||
end
|
||||
eq({true, false, true, false, false, true, false}, nr_focusable)
|
||||
|
||||
command("1wincmd w")
|
||||
eq(1, fn.winnr())
|
||||
command("2wincmd w")
|
||||
eq(3, fn.winnr())
|
||||
command("3wincmd w")
|
||||
eq(3, fn.winnr())
|
||||
command("4wincmd w")
|
||||
eq(6, fn.winnr())
|
||||
command("5wincmd w")
|
||||
eq(6, fn.winnr())
|
||||
command("6wincmd w")
|
||||
eq(6, fn.winnr())
|
||||
command("7wincmd w")
|
||||
eq(6, fn.winnr())
|
||||
|
||||
feed("1<c-w>w")
|
||||
eq(1, fn.winnr())
|
||||
feed("2<c-w>w")
|
||||
eq(3, fn.winnr())
|
||||
feed("999<c-w>w")
|
||||
eq(6, fn.winnr())
|
||||
end)
|
||||
|
||||
it("W", function()
|
||||
|
Reference in New Issue
Block a user