Fix: Enforce split size after Trouble window creation #680
+9
−1
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.
Summary
Ensure Trouble split windows keep the configured size by reapplying height/width immediately after the split is created.
Problem
When opening two Trouble windows (e.g.,
diagnostics+lsp_references), Neovim can equalize split sizes during creation, causing one Trouble window to jump to ~50% of the screen height despitewin.sizebeing configured for both. This happens even withequalalwaysoff in some setups, and results in excess blank space.Reproduction
win.size=8).:Trouble diagnostics toggleand:Trouble lsp_references toggle).Expected
Both Trouble windows should respect the configured size when opened together.
Fix in this PR
After the split is created and the Trouble buffer is attached, explicitly set the window height/width to the requested
opts.size. This is a small adjustment that seeks to preserves existing behavior while preventing unintended equalization.Config
In case it helps in reproduction these are the relevant parts of my config for
trouble.nvimvia Lazy plugin manager:Notes
During the troubleshooting of this issue I ensured that I disabled any nvim configurations that ran autocmd's to ensure that my config wasn't messing with Trouble's functionality.
Trouble Commit:
bd67efe