Skip to content

Commit 57d6f70

Browse files
authored
fix: window picker bug on global statusline (#1098)
1 parent e87ee0e commit 57d6f70

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lua/nvim-tree/actions/open-file.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ local function pick_window()
5858
local laststatus = vim.o.laststatus
5959
vim.o.laststatus = 2
6060

61+
if laststatus == 3 then
62+
local ok_status, statusline = pcall(api.nvim_win_get_option, tree_winid, "statusline")
63+
local ok_hl, winhl = pcall(api.nvim_win_get_option, tree_winid, "winhl")
64+
65+
win_opts[tree_winid] = {
66+
statusline = ok_status and statusline or "",
67+
winhl = ok_hl and winhl or "",
68+
}
69+
70+
api.nvim_win_set_option(tree_winid, "statusline", " ")
71+
api.nvim_win_set_option(tree_winid, "winhl", "StatusLine:NvimTreeWindowPicker")
72+
end
73+
6174
-- Setup UI
6275
for _, id in ipairs(selectable) do
6376
local char = M.window_picker.chars:sub(i, i)
@@ -92,6 +105,12 @@ local function pick_window()
92105
end
93106
end
94107

108+
if laststatus == 3 then
109+
for opt, value in pairs(win_opts[tree_winid]) do
110+
api.nvim_win_set_option(tree_winid, opt, value)
111+
end
112+
end
113+
95114
vim.o.laststatus = laststatus
96115

97116
return win_map[resp]

0 commit comments

Comments
 (0)