Skip to content

Commit 70e88d7

Browse files
committed
Ignore hidden floating windows
1 parent cf766a4 commit 70e88d7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lua/scrollview.lua

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,26 +359,39 @@ local get_scrollview_windows = function()
359359
end
360360

361361
-- Returns the non-workspace floating windows (including scrollview windows).
362-
local get_floating_windows = function()
362+
-- The optional 'hidden' parameter specifies whether hidden floating windows
363+
-- are included (defaults to false).
364+
local get_floating_windows = function(hidden)
365+
if hidden == nil then
366+
hidden = false
367+
end
363368
local result = {}
364369
for winnr = 1, fn.winnr('$') do
365370
local winid = fn.win_getid(winnr)
366371
local config = api.nvim_win_get_config(winid)
367372
local floating = tbl_get(config, 'relative', '') ~= ''
368373
local workspace_win =
369374
fn.getwinvar(winid, WIN_WORKSPACE_BASE_WINID_VAR, -1) ~= -1
370-
if not workspace_win and floating then
375+
local is_hidden = tbl_get(config, 'hide', '') or false
376+
if not workspace_win
377+
and floating
378+
and (hidden or not is_hidden) then
371379
table.insert(result, winid)
372380
end
373381
end
374382
return result
375383
end
376384

377-
local get_non_scrollview_floats = function()
385+
-- Returns the non-scrollview floating windows. The optional 'hidden' parameter
386+
-- specifies whether hidden floating windows are included (defaults to false).
387+
local get_non_scrollview_floats = function(hidden)
388+
if hidden == nil then
389+
hidden = false
390+
end
378391
local memoize_key = GET_NON_SCROLLVIEW_FLOATS_KEY
379392
if memoize and cache[memoize_key] then return cache[memoize_key] end
380393
local result = {}
381-
for _, winid in ipairs(get_floating_windows()) do
394+
for _, winid in ipairs(get_floating_windows(hidden)) do
382395
if not is_scrollview_window(winid) then
383396
table.insert(result, winid)
384397
end

0 commit comments

Comments
 (0)