mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 00:02:10 +00:00
refactor(mobile): name the init option initialData, as the message does
The init option `data` becomes `initialData`, the message field's name, so the controller passes it through unrenamed. The `preserveScroll` why stays on the message type only, and the document test's title names the three grids that carry the frame. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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) })
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user