From 33d9675318b4e7a636f2daa21a3941d492f07564 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 12 Apr 2026 15:27:48 -0600 Subject: [PATCH] fix: WinResized forces redraw to clear stale pixels on tabline shift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The duplicate "turbo-debug" rows stacked at the top weren't from orphan windows — they were leftover render pixels. When bufferline's tabline disappears (buffer count drops back to 1), the tabline row is reclaimed and every window shifts up one row. Nvim redraws at the new positions but doesn't clear the pixels where the old render was, so the content appears doubled. OptionSet on showtabline doesn't fire in this case because bufferline uses a %{% expr format for tabline — the tabline string becomes empty but the showtabline option never changes. My earlier BufEnter/TabEnter fallbacks miss it for the same reason. Only WinResized reliably fires when windows shift from the reclaimed row. New minimal WinResized autocmd: just schedules `redraw!` and does nothing else. No re-pinning (user's manual resizes still stick), no bar recreation (not needed for this case). Cheap and targeted. Co-Authored-By: Claude Opus 4.6 (1M context) --- lua/turbo-debug/mode.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/turbo-debug/mode.lua b/lua/turbo-debug/mode.lua index 52a0925..2884aa9 100644 --- a/lua/turbo-debug/mode.lua +++ b/lua/turbo-debug/mode.lua @@ -1143,6 +1143,21 @@ function M.enter() end) end vim.api.nvim_create_autocmd("VimResized", { group = group, callback = recover_chrome }) + -- WinResized fires when any window's geometry changes — including + -- the shift that happens when bufferline's tabline disappears (the + -- tabline row gets reclaimed, all windows shift up). At that point + -- nvim re-renders at the new positions but doesn't always clear + -- the pixels where the old render was, producing the "duplicate + -- status bar rows" artifact. Forcing a full redraw here wipes the + -- stale pixels. We don't re-pin dapui sizes so user manual resizes + -- still stick. + vim.api.nvim_create_autocmd("WinResized", { + group = group, + callback = function() + if not active then return end + vim.schedule(function() pcall(vim.cmd, "redraw!") end) + end, + }) vim.api.nvim_create_autocmd("OptionSet", { group = group, pattern = "showtabline",