From c143525f300a746a9bb78ccef5bc682e6e9d7d9e Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 12 Apr 2026 14:54:00 -0600 Subject: [PATCH] fix: re-assert layout after tiny-equalizer's VimResized wincmd= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- lua/turbo-debug/mode.lua | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lua/turbo-debug/mode.lua b/lua/turbo-debug/mode.lua index 2dacc01..bcaae31 100644 --- a/lua/turbo-debug/mode.lua +++ b/lua/turbo-debug/mode.lua @@ -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