TUI cursor/rendering corruption when restoring from hidden Neovim terminal buffer

Resolved 💬 3 comments Opened Mar 19, 2026 by danielt812 Closed Apr 17, 2026

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

  1. Open Neovim
  2. Open Claude Code in a full-screen terminal buffer (:terminal claude)
  3. Hide the terminal buffer by switching to a different buffer in the same window (the Claude process remains running in the background)
  4. Show the terminal buffer again by switching back to it
  5. 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 SIGWINCH directly via kill -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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗