Skip to content

Commit d753a1d

Browse files
authored
fix(view): file filter and info popup above floating view
Co-authored-by: Krzysztof Cieśla <[email protected]>
1 parent 011a781 commit d753a1d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lua/nvim-tree/actions/node/file-popup.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ local function setup_window(node)
3232
width = max_width + 1,
3333
height = #lines,
3434
noautocmd = true,
35+
zindex = 60,
3536
})
3637
local winnr = a.nvim_open_win(0, false, open_win_config)
3738
current_popup = {

lua/nvim-tree/live-filter.lua

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ local overlay_bufnr = nil
2525
local overlay_winnr = nil
2626

2727
local function remove_overlay()
28+
if view.View.float.enable then
29+
-- return to normal nvim-tree float behaviour when filter window is closed
30+
a.nvim_create_autocmd("WinLeave", {
31+
pattern = "NvimTree_*",
32+
group = a.nvim_create_augroup("NvimTree", { clear = false }),
33+
callback = view.close,
34+
})
35+
end
36+
2837
a.nvim_win_close(overlay_winnr, { force = true })
2938
overlay_bufnr = nil
3039
overlay_winnr = nil
@@ -92,12 +101,24 @@ local function configure_buffer_overlay()
92101
end
93102

94103
local function create_overlay()
104+
local min_width = 20
105+
if view.View.float.enable then
106+
-- don't close nvim-tree float when focus is changed to filter window
107+
a.nvim_clear_autocmds {
108+
event = "WinLeave",
109+
pattern = "NvimTree_*",
110+
group = a.nvim_create_augroup("NvimTree", { clear = false }),
111+
}
112+
113+
min_width = min_width - 2
114+
end
115+
95116
configure_buffer_overlay()
96117
overlay_winnr = a.nvim_open_win(overlay_bufnr, true, {
97118
col = 1,
98119
row = 0,
99120
relative = "cursor",
100-
width = math.max(20, a.nvim_win_get_width(view.get_winnr()) - #M.prefix - 2),
121+
width = math.max(min_width, a.nvim_win_get_width(view.get_winnr()) - #M.prefix - 2),
101122
height = 1,
102123
border = "none",
103124
style = "minimal",

0 commit comments

Comments
 (0)