Skip to content

Commit b97299e

Browse files
committed
fix: check if force_dirchange should call core.init
1 parent 47c8a7e commit b97299e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lua/nvim-tree.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function M.open_on_directory()
127127
core.init(bufname)
128128
end
129129

130-
explorer_fn("force_dirchange", bufname, true)
130+
explorer_fn("force_dirchange", bufname, true, false)
131131
end
132132

133133
---@return table

lua/nvim-tree/explorer/init.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,15 +737,19 @@ end
737737
---@private
738738
---@param foldername string
739739
---@param should_open_view boolean|nil
740-
function Explorer:force_dirchange(foldername, should_open_view)
740+
---@param should_init boolean|nil
741+
function Explorer:force_dirchange(foldername, should_open_view, should_init)
741742
local profile = log.profile_start("change dir %s", foldername)
742743

743744
local valid_dir = vim.fn.isdirectory(foldername) == 1 -- prevent problems on non existing dirs
744745
if valid_dir then
745746
if self:should_change_dir() then
746747
self:cd(config.actions.change_dir.global, foldername)
747748
end
748-
core.init(foldername)
749+
750+
if should_init ~= false then
751+
core.init(foldername)
752+
end
749753
end
750754

751755
if should_open_view then

0 commit comments

Comments
 (0)