Skip to content

Fix terminal restoration and TUI redraws#336

Merged
parsakhaz merged 1 commit into
mainfrom
fullscreen-claude-tui-issues
Jul 15, 2026
Merged

Fix terminal restoration and TUI redraws#336
parsakhaz merged 1 commit into
mainfrom
fullscreen-claude-tui-issues

Conversation

@parsakhaz

Copy link
Copy Markdown
Member

Summary

  • model every live PTY with headless xterm so alternate-screen state and RunPane screen reads remain authoritative when the renderer unmounts
  • restore the active terminal buffer instead of replaying normal shell history over a live TUI
  • force a timed one-column PTY resize transition on activation and manual refresh so foreground TUIs emit a canonical redraw
  • document Pane's renderer lifecycle and cover terminal modes, restoration selection, RunPane screen output, and forced redraw behavior

Fixes #324.

Why

Pane disposes renderer-side xterm/WebGL resources when a top-level session unmounts while keeping its PTY alive. Reconstructing only from normal scrollback restored the wrong buffer for full-screen and cursor-addressed applications. Even after restoring the correct cells, Claude's TUI could retain a frame computed for the previous renderer geometry until a real window resize delivered a resize notification.

The main process now owns an xterm-compatible screen model. Renderer activation restores that authoritative state, then performs a real PTY size transition and return so the foreground application redraws at the settled dimensions. runpane panels screen reads the same model and no longer sees the launch command in place of the agent screen.

Testing

  • pnpm lint (passes; existing warning baseline only)
  • pnpm typecheck
  • pnpm --filter main test -- --run (41 files, 339 tests)
  • pnpm --filter frontend test (8 files, 93 tests)
  • pnpm build:frontend
  • pnpm build:main
  • pnpm --filter runpane build
  • manually reproduced with Claude default and fullscreen TUI modes in an isolated PANE_DIR; switching panes and tabs now restores and redraws correctly without a physical window resize

Dependency Notes

  • adds @xterm/headless and @xterm/addon-serialize to the main process
  • regenerates NOTICES

@parsakhaz
parsakhaz merged commit ce331f4 into main Jul 15, 2026
16 checks passed
@parsakhaz
parsakhaz deleted the fullscreen-claude-tui-issues branch July 15, 2026 06:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 834150428f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const terminal = this.terminals.get(panelId);
if (!terminal) return null;

await terminal.screenEmulator?.waitForIdle();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound terminal-state idle waits

When a live panel is running high-volume or continuous output, this unbounded waitForIdle() can stay pending because each PTY chunk increments the emulator's pending-write count and the promise only resolves after it reaches zero. This path backs terminal:getState during renderer remount/activation and is also used by runpane panels screen/wait, so commands like yes, a long build, or a log tail can leave the terminal refresh/loading path and local-control commands hanging until output stops. Consider taking the best current snapshot after a short timeout instead of waiting indefinitely.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: upgrade Electron to a supported release

1 participant