Skip to content

Conversation

@aauren
Copy link

@aauren aauren commented Jan 10, 2026

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 despite win.size being configured for both. This happens even with equalalways off in some setups, and results in excess blank space.

Reproduction

  1. Configure Trouble with small bottom sizes (e.g., win.size=8).
  2. Open two modes at once (e.g., :Trouble diagnostics toggle and :Trouble lsp_references toggle).
  3. Observe that a single Trouble window opens to the height that it should
  4. Upon opening the second Trouble window observe one Trouble window expands significantly more than its configured height

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.nvim via Lazy plugin manager:

return {
        {
                "folke/trouble.nvim",
                opts = {
                        preview = {
                                type = "float",
                                relative = "editor",
                                border = "rounded",
                                title = "Preview",
                                title_pos = "center",
                                position = { 0, -2 },
                                size = { width = 0.4, height = 0.6 },
                                zindex = 200,
                        },
                        modes = {
                                lsp_base = {
                                        -- attempt to control the bottom height for LSP References
                                        win = {
                                                position = "bottom",
                                                size = 0.15,
                                        },
                                        focus = true,
                                },
                                diagnostics = {
                                        -- attempt to control the bottom height for Diagnostics
                                        win = {
                                                position = "bottom",
                                                size = 0.15,
                                        },
                                },
                        },
                }
...

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

@github-actions github-actions bot added the size/m Medium PR (<50 lines changed) label Jan 10, 2026
@aauren aauren changed the title Enforce split size after Trouble window creation Fix: Enforce split size after Trouble window creation Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m Medium PR (<50 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant