mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 00:02:39 +00:00
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.
24 lines
986 B
JavaScript
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;
|
|
}`
|