fix: restore file tree width after terminal resize - #33
Open
KEY60228 wants to merge 1 commit into
Open
Conversation
'winfixwidth' excludes the tree window from width redistribution when the terminal grows back after a shrink, so any forced shrink (tmux pane zoom, font size change, window resize) permanently ratcheted the tree below file_tree_width. Re-assert the configured width on VimResized, and rebalance the old/new diff panes which the same event could crush down to 'winminwidth'. Also guard file_tree.close() against E444 when the tree is the last window. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The file tree sometimes ends up much narrower than
file_tree_widthand never recovers.Root cause: the tree window uses
winfixwidth, which excludes it from width redistribution when the terminal grows. So whenever the terminal (tmux pane zoom/unzoom, window resize, font size change) momentarily becomes too narrow to fit the tree, Neovim force-shrinks it — and after the terminal grows back, the tree stays at the shrunken width forever. Each shrink ratchets it further down.Reproduced with an embedded nvim + attached UI:
Fix
ui/file_tree.lua: re-assert the configuredfile_tree_widthonVimResized(augroup cleaned up inclose()).ui/init.lua: rebalance the old/new diff panes onVimResized— the same shrink/grow cycle left one pane crushed atwinminwidth(width 1) while the other took all the space.file_tree.close(): skipnvim_win_closewhen the tree is the last window (previously raisedE444, e.g. pressingqin the tree after:only); deleting the scratch buffer leaves the window on an empty buffer instead.Verification
End-to-end test driving a real
:ReviewThemStartsession in an embedded nvim with an attached UI, resizing vianvim_ui_try_resize:🤖 Generated with Claude Code