diff --git a/config/scripts/mobile-web-app-terminal-probe-route.mjs b/config/scripts/mobile-web-app-terminal-probe-route.mjs index f7bba3e299b..79996974545 100644 --- a/config/scripts/mobile-web-app-terminal-probe-route.mjs +++ b/config/scripts/mobile-web-app-terminal-probe-route.mjs @@ -73,8 +73,8 @@ export default function TerminalProbeRoute() { globalThis.__orcaTerminalEngineErrors = globalThis.__orcaTerminalEngineErrors ?? [] globalThis.__orcaTerminalBeforeInput = [] globalThis.__orcaTerminalProbe = { - init: (cols, rows, data) => - handleRef.current?.init({ cols, rows, data, oscLinks: [], frame: frameRef.current }), + init: (cols, rows, initialData) => + handleRef.current?.init({ cols, rows, initialData, oscLinks: [], frame: frameRef.current }), write: (data) => handleRef.current?.write(data), selectAll: () => handleRef.current?.doSelectAll(), fit: () => handleRef.current?.fitDimensions(frameRef.current), diff --git a/mobile/src/session/mobile-session-route-parity.test.ts b/mobile/src/session/mobile-session-route-parity.test.ts index 7905a58601e..53723196ebd 100644 --- a/mobile/src/session/mobile-session-route-parity.test.ts +++ b/mobile/src/session/mobile-session-route-parity.test.ts @@ -136,7 +136,8 @@ const HEAD_CALLBACK_IDENTITY_SHA256 = // Again when the document took the hold rule and the subscribe stopped holding its grid. // Again when an init took one options object. // Again when the frame's layout became one `notifyTerminalFrame`. -const HEAD_CALLBACK_BODY_SHA256 = '8f2ecfc86d6b50dfcf2248135c12a1a97c0b63a50176fc330781e805f388bbd3' +// Again when the init option took the message's name, `initialData`. +const HEAD_CALLBACK_BODY_SHA256 = '4848e925f478f1656f26031c1bdebbb9f2da60811c7e91cfd732fc9da9764079' // Refreshed for the startup effect: both `worktree.activate` sends became `worktreeActivate`, and // the sleeping-agent check reads that operation's verdict instead of the reply envelope. Refreshed // again when the reporter took the reply and interpreted it itself, retiring the hand-built diff --git a/mobile/src/session/use-mobile-session-terminal-subscription.ts b/mobile/src/session/use-mobile-session-terminal-subscription.ts index 6850ff37b21..73af79a959d 100644 --- a/mobile/src/session/use-mobile-session-terminal-subscription.ts +++ b/mobile/src/session/use-mobile-session-terminal-subscription.ts @@ -195,7 +195,7 @@ export function useMobileSessionTerminalSubscription( }) return } - ref.init({ cols, rows, data: initialData, oscLinks, frame: terminalFrameRef.current }) + ref.init({ cols, rows, initialData, oscLinks, frame: terminalFrameRef.current }) initializedHandlesRef.current.add(handle) if (data.displayMode) { const displayMode = data.displayMode as MobileDisplayMode @@ -266,7 +266,7 @@ export function useMobileSessionTerminalSubscription( getTerminalRef(handle)?.init({ cols, rows, - data: serialized, + initialData: serialized, preserveScroll: true, oscLinks, frame: terminalFrameRef.current diff --git a/mobile/src/terminal/document/laid-out-cell-box.test.ts b/mobile/src/terminal/document/laid-out-cell-box.test.ts index 81f801b6410..5a8ed7453a0 100644 --- a/mobile/src/terminal/document/laid-out-cell-box.test.ts +++ b/mobile/src/terminal/document/laid-out-cell-box.test.ts @@ -128,7 +128,7 @@ describe('a started document', () => { const reflowTo = (scope: TerminalDocumentScope, cols: number) => handleMsg(scope, { type: 'reflow', cols, rows: 47 }) - it('takes the frame the app laid out from init, as from a measure', () => { + it('takes the frame the app laid out from init, resize and reflow', () => { const { scope } = started() try { handleMsg(scope, { diff --git a/mobile/src/terminal/terminal-webview-cell-box.test.ts b/mobile/src/terminal/terminal-webview-cell-box.test.ts index 95e7a461f31..602bddd0f37 100644 --- a/mobile/src/terminal/terminal-webview-cell-box.test.ts +++ b/mobile/src/terminal/terminal-webview-cell-box.test.ts @@ -125,7 +125,7 @@ describe('the cell box xterm laid out', () => { expect(handle().fitDimensions({ width: 427.5, height: 0 })).toBeNull() expect(handle().fitDimensions({ width: 427.5, height: 710 })).toEqual({ cols: 55, rows: 47 }) const frame = { width: 427.5, height: 710 } - handle().init({ cols: 55, rows: 47, data: '', frame }) + handle().init({ cols: 55, rows: 47, initialData: '', frame }) handle().resize(55, 47, frame) handle().reflow(55, 47, frame) const grids = nativeWebViewMethods.postMessage.mock.calls @@ -137,7 +137,7 @@ describe('the cell box xterm laid out', () => { it('sends nothing before a ready: a load start drops what was queued', () => { const { handle, notify, webView } = mount() - handle().init({ cols: 55, rows: 47, data: 'snapshot', frame: null }) + handle().init({ cols: 55, rows: 47, initialData: 'snapshot', frame: null }) expect(postedTypes()).toEqual([]) act(() => webView().props.onLoadStart()) notify({ type: 'web-ready', cellBox: cellAt(scale) }) diff --git a/mobile/src/terminal/terminal-webview-contract.ts b/mobile/src/terminal/terminal-webview-contract.ts index ae2aa93260b..1c9960ab1ec 100644 --- a/mobile/src/terminal/terminal-webview-contract.ts +++ b/mobile/src/terminal/terminal-webview-contract.ts @@ -99,8 +99,7 @@ export type TerminalWebViewProps = { export type TerminalInit = { cols: number rows: number - data?: string - // Why: a width reflow re-streams the same content rewrapped; keep the reader's place. + initialData?: string preserveScroll?: boolean oscLinks?: TerminalOscLinkRange[] frame: TerminalFrame | null diff --git a/mobile/src/terminal/terminal-write-coalescer-boundaries.test.ts b/mobile/src/terminal/terminal-write-coalescer-boundaries.test.ts index 30b847b29ff..39615ef3692 100644 --- a/mobile/src/terminal/terminal-write-coalescer-boundaries.test.ts +++ b/mobile/src/terminal/terminal-write-coalescer-boundaries.test.ts @@ -125,7 +125,7 @@ describe('terminal write coalescer boundaries', () => { it('clears the coalescer before posting init and clear (snapshot supersession)', () => { // Anchor on the init() signature (unique) — 'init(' alone also matches comments. const initStart = controllerSource.indexOf( - 'init({ cols, rows, data, preserveScroll, oscLinks, frame }' + 'init({ cols, rows, initialData, preserveScroll, oscLinks, frame }' ) const initClear = controllerSource.indexOf('writeCoalescer.clear()', initStart) const initPost = controllerSource.indexOf("type: 'init'", initStart) diff --git a/mobile/src/terminal/use-terminal-webview-controller.ts b/mobile/src/terminal/use-terminal-webview-controller.ts index 02991817658..8ca48f55a65 100644 --- a/mobile/src/terminal/use-terminal-webview-controller.ts +++ b/mobile/src/terminal/use-terminal-webview-controller.ts @@ -263,7 +263,7 @@ export function useTerminalWebViewController( write(data: string) { writeCoalescer.write(data) }, - init({ cols, rows, data, preserveScroll, oscLinks, frame }: TerminalInit) { + init({ cols, rows, initialData, preserveScroll, oscLinks, frame }: TerminalInit) { // Why: arm a fresh ready promise BEFORE posting init. The document resolves it via the // 'ready' notify at the end of its rAF chain. promises.armReady() @@ -274,7 +274,7 @@ export function useTerminalWebViewController( type: 'init', cols, rows, - initialData: data, + initialData, oscLinks, terminalTheme, fontScale: textScale,