Files
orca/mobile/scripts/hosted-terminal-instance-inspection.mjs
T
Jinwoo-H f2909d3539 test(mobile): verify hosted Terminal preferences in session consumers
Exercise text scale, autocorrect and custom shortcut persistence through the real hosted settings and session. Reuse picker and terminal inspection logic and restore original preferences. Full iOS adversarial run passed with ok:true against build eab7fd8f5eb4a37e593526e90dcc5105552691db072da8a982cd1ed30784a2e3; all code gates and export passed.
2026-09-06 21:30:49 -04:00

24 lines
986 B
JavaScript

export const HOSTED_TERMINAL_INSTANCE_LOOKUP = `function findTerminal(element) {
for (
let ancestor = element;
ancestor instanceof HTMLElement;
ancestor = ancestor.parentElement
) {
const fiberKey = Object.keys(ancestor).find((key) => key.startsWith('__reactFiber$'));
let fiber = fiberKey ? ancestor[fiberKey] : null;
for (let depth = 0; fiber && depth < 32; depth += 1, fiber = fiber.return) {
let hook = fiber.memoizedState;
for (let index = 0; hook && index < 32; index += 1, hook = hook.next) {
const current = hook.memoizedState?.current;
if (
current &&
Number.isInteger(current.cols) &&
Number.isInteger(current.rows) &&
current.buffer?.active
) return current;
}
}
}
return null;
}`