Repository navigation
fix(terminal): a woken pane's new prompt starts on its own line when reattached - #33494
Conversation
…reattached After Wake the window paints the restored history and then blanks its viewport, so the new shell's prompt starts on a clean screen. The daemon's own copy of the screen, seeded with the same history, skipped that step. A later reattach (a reload, a second window, the phone) therefore showed the new prompt beside the dead shell's last one: `p7/sub$ orca@awin:~/projects/p7$` (awin verify-11). The seed now ends with the same viewport blanking the window writes, built by one shared function, after the process-boundary ground, which still never moves the cursor. Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
ELI5
After waking a sleeping terminal and then reloading the window (or opening it from another window or the phone), the new shell's prompt appeared on the same line as the old one, like
p7/sub$ orca@awin:~/projects/p7$. Now the new prompt starts on its own line, the same way it already does the first time the terminal is shown.What Changed
Before:
After: the daemon's copy matches what the window shows. The history is kept in scrollback and the new prompt starts on a fresh viewport.
Mechanism:
getRecoveredHistorySeedSegmentsnow ends the seed with the same viewport-blanking sequence the window writes after a cold restore, after the existing process-boundary ground.buildFreshShellViewportBlankingSequence) moved from the renderer tosrc/shared/terminal-fresh-shell-viewport.ts, so both sides use one definition.Why
The window's viewport blanking is the proven behaviour on first view. Doing the same in the daemon makes every later view agree with it, rather than inventing a second rule, such as appending a bare newline, that could disagree with the window.
Linked Issue
Found by a Windows/WSL verification run of plain Sleep → Wake. It is not caused by the recent WSL folder fixes (#33398, #33425). The daemon seed has never blanked its viewport; it shows on bash, which, unlike zsh, doesn't move a prompt off a partial line by itself.
Visual Proof
N/A: main-process terminal state with no UI code change. Pinned by an emulator test that seeds a dead shell's screen and writes the new prompt.
Testing
process-boundary-ground.test.ts:OLD_OUTPUT_1,OLD_OUTPUT_2and the old$, and the prompt sits on its own last line. Fails onmain.terminal-history-seed-segments.test.ts: the seed's segments end with the blanking, on both the normal and alternate-screen branches.pnpm test src/main/daemon src/renderer/src/components/terminal-pane src/main/runtime/orca-runtime.test.ts: the only failures fail on cleanmaintoo here: the real-shell shell-ready tests, and two existing-folder import tests.pnpm tc,check:code-quality:changedandrun-ratchets.mjspass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code