Skip to content

Garbled screen on reattach after exiting alternate screen buffer apps (Claude Code, vim) #122

@datasciencemonkey

Description

@datasciencemonkey

Problem

When a user exits Claude Code (or any alternate screen buffer app like vim) and then reattaches to the session, the terminal shows a screen full of repeated bash prompts and residual rendering artifacts.

Root Cause

The output buffer (deque of last 1000 chunks) accumulates raw PTY output including alternate screen enter/exit sequences. On reattach, _doAttach() replays the entire buffer, causing the alternate screen sequences and stale prompts to render.

Expected Behavior

After reattach, the terminal should show a clean screen with the current shell prompt.

Fix

Send a screen clear and resize after reattach to force a clean terminal state.

Fixed in #119.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions