Skip to content

Commit d43ab67

Browse files
authored
fix(#2879): remove unnecessary tree window width setting to prevent unnecessary :wincmd = (#2881)
1 parent 6fbcb5a commit d43ab67

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Diff for: lua/nvim-tree/view.lua

+9-5
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,18 @@ function M.resize(size)
346346
return
347347
end
348348

349-
local new_size = get_width()
350-
vim.api.nvim_win_set_width(M.get_winnr() or 0, new_size)
349+
local winnr = M.get_winnr() or 0
351350

352-
events._dispatch_on_tree_resize(new_size)
351+
local new_size = get_width()
353352

354-
if not M.View.preserve_window_proportions then
355-
vim.cmd ":wincmd ="
353+
if new_size ~= vim.api.nvim_win_get_width(winnr) then
354+
vim.api.nvim_win_set_width(winnr, new_size)
355+
if not M.View.preserve_window_proportions then
356+
vim.cmd ":wincmd ="
357+
end
356358
end
359+
360+
events._dispatch_on_tree_resize(new_size)
357361
end
358362

359363
function M.reposition_window()

0 commit comments

Comments
 (0)