From 14039337a563f4efd72831888f332a15585f0ea1 Mon Sep 17 00:00:00 2001 From: cpp_programmer Date: Sun, 27 Oct 2024 00:26:47 -0600 Subject: [PATCH] fix(#2969): After a rename, the node loses selection (#2974) Co-authored-by: Lucian Ion --- lua/nvim-tree/actions/fs/rename-file.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/actions/fs/rename-file.lua b/lua/nvim-tree/actions/fs/rename-file.lua index da1ca001..efe40a34 100644 --- a/lua/nvim-tree/actions/fs/rename-file.lua +++ b/lua/nvim-tree/actions/fs/rename-file.lua @@ -161,12 +161,14 @@ function M.fn(default_modifier) return end - M.rename(node, prepend .. new_file_path .. append) + local full_new_path = prepend .. new_file_path .. append + + M.rename(node, full_new_path) if not M.config.filesystem_watchers.enable then explorer:reload_explorer() end - find_file(utils.path_remove_trailing(new_file_path)) + find_file(utils.path_remove_trailing(full_new_path)) end) end end