fix: re-assert layout after tiny-equalizer's VimResized wincmd=

User's tiny-equalizer.nvim runs 'tabdo wincmd =' on every VimResized,
equalizing every window — which destroys our explicit sidebar/console
sizing and bar pinning. Not focus.nvim like I guessed; the real
culprit is their own plugin doing exactly what it says on the tin.

Fix: defer our VimResized reposition via vim.schedule so our handler
runs AFTER tiny-equalizer's `wincmd =` in the same event-loop tick.
We re-pin the layout and reverse the equalization damage.

Also added a WinResized autocmd (guarded against recursion via
M._pinning flag) so that individual-window resizes — including
manual user drags on pane separators and other `wincmd =` invocations
from anywhere else — also trigger a re-pin. This is more aggressive
than the VimResized coverage but necessary because mouse-drag resizes
don't fire VimResized.

Trade-off: the user can no longer manually resize a single dapui pane
and have the size stick — winfixheight + our re-pin will snap it back.
That's the correct behavior for debug mode (we own the layout); users
who want manual resize can toggle debug mode off.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 4.6 committed 2026-04-12 14:54:00 -06:00
1 parent f5647e53f6
commit c143525f30
1 file changed
+26 -1
+26 -1
View File
@@ -1087,7 +1087,32 @@ function M.enter()
})
vim.api.nvim_create_autocmd("VimResized", {
group = group,
callback = reposition_bars,
callback = function()
-- Defer via vim.schedule so our pin runs AFTER any other plugin's
-- VimResized handler in the same event-loop tick. The user has
-- tiny-equalizer.nvim which runs `tabdo wincmd =` on VimResized,
-- equalizing every window — that fights our explicit sizing. By
-- re-asserting after them, we restore the layout.
vim.schedule(reposition_bars)
end,
})
-- WinResized fires on any individual window resize (including user
-- mouse-drags on separators, or `wincmd =` from other plugins). We
-- re-pin defensively so intentional user resizes stick but drive-by
-- equalizer plugins don't wipe our layout.
vim.api.nvim_create_autocmd("WinResized", {
group = group,
callback = function()
-- Only respond to resizes we DIDN'T initiate. Guard with a flag
-- so our own pin_dapui_sizes doesn't trigger an infinite loop.
if M._pinning then return end
vim.schedule(function()
if not active then return end
M._pinning = true
pin_dapui_sizes()
M._pinning = false
end)
end,
})
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(buf) then M._install_for_buf(buf) end