Skip to content

Commit

Permalink
fix(#2879): remove unnecessary tree window width setting to prevent u…
Browse files Browse the repository at this point in the history
…nnecessary :wincmd = (#2881)
  • Loading branch information
alex-courtis authored Aug 25, 2024
1 parent 6fbcb5a commit d43ab67
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lua/nvim-tree/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,18 @@ function M.resize(size)
return
end

local new_size = get_width()
vim.api.nvim_win_set_width(M.get_winnr() or 0, new_size)
local winnr = M.get_winnr() or 0

events._dispatch_on_tree_resize(new_size)
local new_size = get_width()

if not M.View.preserve_window_proportions then
vim.cmd ":wincmd ="
if new_size ~= vim.api.nvim_win_get_width(winnr) then
vim.api.nvim_win_set_width(winnr, new_size)
if not M.View.preserve_window_proportions then
vim.cmd ":wincmd ="
end
end

events._dispatch_on_tree_resize(new_size)
end

function M.reposition_window()
Expand Down

0 comments on commit d43ab67

Please sign in to comment.