Skip to content

Commit 0f6dc22

Browse files
committed
fix: add check to not use new opts for certain edit modes
1 parent f4757a3 commit 0f6dc22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/nvim-tree/api.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@ local function edit(mode, node, edit_opts)
239239

240240
edit_opts = edit_opts or {}
241241

242-
if edit_opts.quit_on_open then
242+
local mode_unsupported_quit_on_open = mode == "drop" or mode == "tab_drop" or mode == "edit_in_place"
243+
if not mode_unsupported_quit_on_open and edit_opts.quit_on_open then
243244
view.close(cur_tabpage)
244245
end
245246

247+
local mode_unsupported_focus = mode == "drop" or mode == "tab_drop" or mode == "edit_in_place"
246248
local focus = edit_opts.focus == nil or edit_opts.focus == true
247-
if not focus then
249+
if not mode_unsupported_focus and not focus then
248250
-- if mode == "tabnew" a new tab will be opened and we need to focus back to the previous tab
249251
if mode == "tabnew" then
250252
vim.cmd(":tabprev")

0 commit comments

Comments
 (0)