TUI cursor/rendering corruption when restoring from hidden Neovim terminal buffer
Description
When running Claude Code inside a Neovim terminal buffer that gets hidden and then restored, the TUI renders incorrectly — the cursor position is offset from where it should be (slightly above the prompt), and there are duplicate ? shortcut hint characters visible. The UI appears to be rendering at a stale offset.
Steps to reproduce
- Open Neovim
- Open Claude Code in a full-screen terminal buffer (
:terminal claude) - Hide the terminal buffer by switching to a different buffer in the same window (the Claude process remains running in the background)
- Show the terminal buffer again by switching back to it
- Observe the cursor is misaligned and the TUI is partially garbled
Expected behavior
Claude Code's TUI should re-render correctly when the terminal buffer is shown again, similar to how lazygit handles this scenario perfectly.
Workaround
Manually resizing the Ghostty terminal window forces a proper re-render and fixes the issue. This suggests Claude Code handles SIGWINCH from a real window resize correctly, but does not properly handle the resize signal triggered by Neovim's jobresize() or Ctrl-L (\x0c).
What was tried (from the Neovim side)
vim.fn.jobresize()to correct dimensions — no effect- Sending
\x0c(Ctrl-L) to the channel — no effect - Sending
SIGWINCHdirectly viakill -SIGWINCH <pid>— no effect - Double resize (shrink by 1, then restore) with delays — no effect
vim.cmd("redraw!")— no effect- All of the above work fine for lazygit in the same terminal management setup
Environment
- Terminal: Ghostty
- OS: macOS (Darwin 25.3.0)
- Neovim: latest stable
- Claude Code: latest
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗