Skip to content

Commit 2f00d64

Browse files
committed
fix(files): prevent double reset_search on submit, fixes #185
1 parent 67b4de6 commit 2f00d64

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lua/neo-tree/sources/filesystem/lib/filter.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,12 @@ M.show_filter = function(state, search_as_you_type, fuzzy_finder_mode)
158158

159159
input:on({ event.BufLeave, event.BufDelete }, function()
160160
input:unmount()
161-
if fuzzy_finder_mode and utils.truthy(state.search_pattern) then
162-
fs.reset_search(state, true)
163-
end
161+
-- If this was closed due to submit, that function will handle the reset_search
162+
vim.defer_fn(function ()
163+
if fuzzy_finder_mode and utils.truthy(state.search_pattern) then
164+
fs.reset_search(state, true)
165+
end
166+
end, 100)
164167
restore_height()
165168
end, { once = true })
166169

0 commit comments

Comments
 (0)