@@ -25,6 +25,15 @@ local overlay_bufnr = nil
25
25
local overlay_winnr = nil
26
26
27
27
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
+
28
37
a .nvim_win_close (overlay_winnr , { force = true })
29
38
overlay_bufnr = nil
30
39
overlay_winnr = nil
@@ -92,12 +101,24 @@ local function configure_buffer_overlay()
92
101
end
93
102
94
103
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
+
95
116
configure_buffer_overlay ()
96
117
overlay_winnr = a .nvim_open_win (overlay_bufnr , true , {
97
118
col = 1 ,
98
119
row = 0 ,
99
120
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 ),
101
122
height = 1 ,
102
123
border = " none" ,
103
124
style = " minimal" ,
0 commit comments