claude-code - 💡(How to fix) Fix TUI doesn't redraw after external editor (Ctrl+G) closes [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46494Fetched 2026-04-11 06:18:49
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
commented ×3labeled ×3cross-referenced ×1

After using Ctrl+G to open an external editor (neovim), the TUI does not properly redraw when the editor exits. The entire conversation area is blank — only the prompt input line and project badge at the bottom are visible. The conversation history only reappears when Claude starts generating new output, or when the terminal window is resized.

Error Message

  1. Press Ctrl+G — Claude Code appears to clear the entire terminal before spawning the editor process
  2. Editor opens (neovim, which uses alternate screen buffer)
  3. Save and quit the editor
  4. Terminal shows: blank/dark conversation area, only the bottom prompt bar is visible
  5. Switching terminal tabs does NOT trigger a redraw
  6. Resizing the terminal window DOES trigger a redraw and restores the full conversation
  7. Claude generating new output also triggers a redraw

Root Cause

After using Ctrl+G to open an external editor (neovim), the TUI does not properly redraw when the editor exits. The entire conversation area is blank — only the prompt input line and project badge at the bottom are visible. The conversation history only reappears when Claude starts generating new output, or when the terminal window is resized.

Fix Action

Fix / Workaround

Workaround attempts

  • macOS (Darwin 24.6.0)
  • Terminal: Ghostty
  • Editor: neovim (configured via custom editor script)
  • Running inside tmux for the popup workaround
RAW_BUFFERClick to expand / collapse

Description

After using Ctrl+G to open an external editor (neovim), the TUI does not properly redraw when the editor exits. The entire conversation area is blank — only the prompt input line and project badge at the bottom are visible. The conversation history only reappears when Claude starts generating new output, or when the terminal window is resized.

Observed behavior

  1. Press Ctrl+G — Claude Code appears to clear the entire terminal before spawning the editor process
  2. Editor opens (neovim, which uses alternate screen buffer)
  3. Save and quit the editor
  4. Terminal shows: blank/dark conversation area, only the bottom prompt bar is visible
  5. Switching terminal tabs does NOT trigger a redraw
  6. Resizing the terminal window DOES trigger a redraw and restores the full conversation
  7. Claude generating new output also triggers a redraw

This suggests the Ink TUI is not calling a repaint/fullRedraw after the editor child process exits. The underlying state is fine — it's purely a rendering issue.

Workaround attempts

  • kill -SIGWINCH $PPID after editor exits — did not work
  • Terminal resize escape sequences (\e[8;...t) after editor exits — did not work
  • printf '\e[?1049l' (force exit alternate screen) — did not work
  • tmux popup -E (isolates editor in separate PTY) — partially works, but Claude Code still clears the screen behind the popup when entering editor mode, and redraws slightly offset after returning

Environment

  • macOS (Darwin 24.6.0)
  • Terminal: Ghostty
  • Editor: neovim (configured via custom editor script)
  • Running inside tmux for the popup workaround

Expected behavior

The TUI should trigger a full repaint immediately after the external editor process exits, regardless of whether the editor used the alternate screen buffer.

Note: I have screenshots demonstrating the issue but gh CLI doesn't support image uploads. Happy to add them if requested.

extent analysis

TL;DR

The issue can be potentially resolved by finding a way to trigger a full repaint of the TUI after the external editor exits, possibly by sending a signal or escape sequence to the terminal.

Guidance

  • Investigate the kill -SIGWINCH $PPID approach further, as it's a common way to trigger a terminal resize event, which is known to trigger a redraw in this case. The fact that it didn't work initially may indicate a timing or synchronization issue.
  • Explore alternative methods to exit the alternate screen buffer used by neovim, as the printf '\e[?1049l' command did not work. This might involve checking neovim's configuration or using a different escape sequence.
  • Consider using a different terminal or environment to see if the issue is specific to Ghostty or macOS. This could help determine if the problem is related to the terminal emulator or the operating system.
  • Look into the tmux configuration and the custom editor script to ensure that they are not interfering with the TUI's ability to redraw after the editor exits.

Example

No code snippet is provided, as the issue seems to be related to the interaction between the TUI, terminal, and editor, and a code example would not be directly relevant.

Notes

The issue appears to be specific to the combination of Ghostty, neovim, and macOS, and may not be reproducible in other environments. The fact that resizing the terminal window triggers a redraw suggests that the underlying state is correct, and the problem is purely a rendering issue.

Recommendation

Apply a workaround, such as using a different terminal or editor, until a more permanent solution can be found. The tmux popup -E approach shows promise, but its limitations and potential side effects need to be further investigated.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The TUI should trigger a full repaint immediately after the external editor process exits, regardless of whether the editor used the alternate screen buffer.

Note: I have screenshots demonstrating the issue but gh CLI doesn't support image uploads. Happy to add them if requested.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING