Skip to content

Commit 8b0857b

Browse files
committed
fix(files): ensure follow_current_file does not fire on netrw hijack
1 parent aea3110 commit 8b0857b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lua/neo-tree.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@ local hijack_netrw = function()
147147
utils.debounce("hijack_netrw_" .. winid, function()
148148
local state
149149
if should_open_split then
150+
log.info("hijack_netrw: opening split")
150151
state = manager.get_state("filesystem", nil, winid)
151152
state.current_position = "split"
152153
else
154+
log.info("hijack_netrw: opening default")
153155
M.close_all_except("filesystem")
154156
state = manager.get_state("filesystem")
155157
end

lua/neo-tree/sources/filesystem/init.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ M.follow = function(callback, force_show)
109109
end
110110

111111
M._navigate_internal = function(state, path, path_to_reveal, callback)
112-
log.trace("navigate_internal", path, path_to_reveal)
112+
log.trace("navigate_internal", state.current_position, path, path_to_reveal)
113113
state.dirty = false
114114
local path_changed = false
115115
if path == nil then
@@ -133,7 +133,11 @@ M._navigate_internal = function(state, path, path_to_reveal, callback)
133133
fs_scan.get_items_async(state, nil, path_to_reveal, callback)
134134
else
135135
local is_search = utils.truthy(state.search_pattern)
136-
local follow_file = not is_search and state.follow_current_file and manager.get_path_to_reveal()
136+
local is_split = state.current_position == "split"
137+
local follow_file = state.follow_current_file
138+
and not is_search
139+
and not is_split
140+
and manager.get_path_to_reveal()
137141
local handled = false
138142
if utils.truthy(follow_file) then
139143
handled = follow_internal(callback, true)

0 commit comments

Comments
 (0)