[BUG] Previous TUI output disappears after returning from external editor (Ctrl+G → g), restored by terminal resize

Resolved 💬 9 comments Opened Mar 9, 2026 by m1ng112 Closed May 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When using Ctrl+G → <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">g</code> to open an external editor (vim), all previous Claude Code conversation output disappears after saving and exiting the editor. Only the input prompt remains visible.</p>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The content is <strong>not lost</strong> — triggering a terminal resize (e.g., splitting a tmux pane, or manually dragging the terminal window edge) immediately restores all previous output. This confirms the buffer data is intact and the issue is specifically in the TUI screen redraw logic after returning from the alternate screen buffer.</p>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Isolation results</h3>
<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">I tested across different environments to isolate the root cause:</p>
<table>
<tr><th>Environment</th><th>Result</th></tr>
<tr><td>WezTerm (WebGpu) + tmux</td><td>❌ Output disappears</td></tr>
<tr><td>WezTerm (OpenGL) + tmux</td><td>❌ Output disappears</td></tr>
<tr><td>WezTerm standalone (no tmux)</td><td>❌ Output disappears</td></tr>
<tr><td>Terminal.app + tmux</td><td>❌ Output disappears</td></tr>
</table>

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">This confirms the issue is in Claude Code's TUI, not in the terminal emulator or multiplexer.</p>
<h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Additional observations</h3>
<ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">tmux refresh-client</code> does <strong>not</strong> restore the output</li>
<li class="whitespace-normal break-words pl-2">Terminal resize <strong>does</strong> restore it (pane split, window resize, etc.)</li>
<li class="whitespace-normal break-words pl-2">tmux <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">alternate-screen</code> / <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">smcup@:rmcup@</code> settings have no effect</li></ul>

What Should Happen?

After exiting the external editor, Claude Code should redraw/restore all previous conversation output.

Error Messages/Logs

Steps to Reproduce

  1. Start Claude Code (claude)
  2. Have a conversation — generate some visible output
  3. Press Ctrl+G, then g to open the external editor (vim)
  4. Save and exit vim (:wq or :q)
  5. Observe: all previous conversation output is gone; only the input prompt is visible
  6. Resize the terminal window → all output is restored

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

v2.1.71

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Related Issues

#9218 — Ctrl-G causes terminal corruption (Linux, v2.0.11) — similar trigger, different severity
#20045 — Feature request to keep conversation visible during Ctrl-G editor
#10293 — Image paste broken after Ctrl-G editor exit — related terminal state restoration issue
#10045 / #10239 — TUI content disappears, restored by resize — same restore behavior, different trigger

View original on GitHub ↗

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