44 INITIAL_TERMINAL_OUTPUT_CURSOR ,
55 nextTerminalAttachSeedState ,
66} from "@t3tools/client-runtime/state/terminal" ;
7- import { synchronizeTerminalOutput } from "../../components/ThreadTerminalDrawer" ;
7+ import { synchronizeTerminalSession } from "../../components/ThreadTerminalDrawer" ;
88
99import { GhosttyTerminalCore , type GhosttyCell , type GhosttyRow } from "./core" ;
1010import {
@@ -445,7 +445,8 @@ describe("GhosttyTerminalSurface visibility", () => {
445445 it ( "keeps a selection through redraws until the selected text changes" , async ( ) => {
446446 const harness = createHarness ( ) ;
447447 const surface = await harness . create ( ) ;
448- let state = applyTerminalAttachStreamEvent ( nextTerminalAttachSeedState ( ) , {
448+ const seed = nextTerminalAttachSeedState ( ) ;
449+ let state = applyTerminalAttachStreamEvent ( seed , {
449450 type : "snapshot" ,
450451 snapshot : {
451452 threadId : "thread" ,
@@ -461,7 +462,7 @@ describe("GhosttyTerminalSurface visibility", () => {
461462 updatedAt : "2026-10-20T00:00:00.000Z" ,
462463 } ,
463464 } ) ;
464- let cursor = synchronizeTerminalOutput ( surface , state , INITIAL_TERMINAL_OUTPUT_CURSOR ) ;
465+ let cursor = synchronizeTerminalSession ( surface , seed , state , INITIAL_TERMINAL_OUTPUT_CURSOR ) ;
465466 harness . flushFrame ( ) ;
466467 harness . pointer ( "pointerdown" , 5 , 1 ) ;
467468 harness . pointer ( "pointermove" , 85 , 1 ) ;
@@ -470,13 +471,14 @@ describe("GhosttyTerminalSurface visibility", () => {
470471
471472 // A TUI repaints its spinner line in place, the way Claude Code redraws.
472473 const redraw = ( data : string ) => {
474+ const previous = state ;
473475 state = applyTerminalAttachStreamEvent ( state , {
474476 type : "output" ,
475477 threadId : "thread" ,
476478 terminalId : "term-1" ,
477479 data,
478480 } ) ;
479- cursor = synchronizeTerminalOutput ( surface , state , cursor ) ;
481+ cursor = synchronizeTerminalSession ( surface , previous , state , cursor ) ;
480482 } ;
481483 redraw ( "\r\x1b[2K* Working |" ) ;
482484 expect ( surface . getSelection ( ) ) . toBe ( "* Working |" ) ;
0 commit comments