Skip to content

Commit d797d22

Browse files
committed
Merge branch '2415-highlight-overhaul' into 2415-highlight-open-modified-additive
2 parents 87d49ec + 5568696 commit d797d22

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lua/nvim-tree/actions/fs/remove-file.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ local M = {
99
}
1010

1111
local function close_windows(windows)
12-
if view.View.float.enable and #vim.api.nvim_list_wins() == 1 then
12+
-- Prevent from closing when the win count equals 1 or 2,
13+
-- where the win to remove could be the last opened.
14+
-- For details see #2503.
15+
if view.View.float.enable and #vim.api.nvim_list_wins() < 3 then
1316
return
1417
end
1518

@@ -24,15 +27,15 @@ local function clear_buffer(absolute_path)
2427
local bufs = vim.fn.getbufinfo { bufloaded = 1, buflisted = 1 }
2528
for _, buf in pairs(bufs) do
2629
if buf.name == absolute_path then
30+
local tree_winnr = vim.api.nvim_get_current_win()
2731
if buf.hidden == 0 and (#bufs > 1 or view.View.float.enable) then
28-
local winnr = vim.api.nvim_get_current_win()
2932
vim.api.nvim_set_current_win(buf.windows[1])
3033
vim.cmd ":bn"
31-
if not view.View.float.enable then
32-
vim.api.nvim_set_current_win(winnr)
33-
end
3434
end
3535
vim.api.nvim_buf_delete(buf.bufnr, { force = true })
36+
if not view.View.float.quit_on_focus_loss then
37+
vim.api.nvim_set_current_win(tree_winnr)
38+
end
3639
if M.config.actions.remove_file.close_window then
3740
close_windows(buf.windows)
3841
end

lua/nvim-tree/actions/fs/rename-file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function M.rename(node, to)
3434
if not success then
3535
return notify.warn(err_fmt(notify_from, notify_to, err))
3636
end
37-
notify.info(notify_from .. "" .. notify_to)
37+
notify.info(string.format("%s -> %s", notify_from, notify_to))
3838
utils.rename_loaded_buffers(node.absolute_path, to)
3939
events._dispatch_node_renamed(node.absolute_path, to)
4040
end

0 commit comments

Comments
 (0)