Files
orca/src/shared/terminal-link-buffer.ts
T
Kelvin Amoaba f719d0fb10 fix(mobile): open terminal urls and file paths with desktop's link detection (#33964)
* fix(mobile): open wrapped terminal urls and paths with desktop's link detection

Desktop's terminal URL and file-link detectors move to src/shared and the phone's
WebView document calls them, replacing its single-row copies. File taps carry every
reading of the tapped text so the phone opens the longest one the host finds, as
desktop does.

* fix(mobile): keep the unc host of osc 8 file links for the host to resolve

* fix(mobile): resolve terminal file-tap readings a few at a time

A tap inside a run of path rows yields hundreds of hard-wrap guesses; firing them all at once overflowed the page bridge's pending-request cap and the real path was never checked.

* refactor(terminal): share the osc 8 link classifier and trim file-tap plumbing

Desktop and the phone now read OSC 8 targets through one shared classifier. Terminal file taps carry only their candidate list, deduped by path, and desktop checks OSC overlap only for candidates it can resolve.

* refactor(terminal): keep shared link files under the line cap

The xterm buffer subset gets its own module, and the text-only OSC resolver goes now that the router uses findExactTerminalFileLink.
2026-10-27 05:30:05 +00:00

22 lines
667 B
TypeScript

// Structural subset of xterm's buffer API so desktop xterm and the mobile document both fit.
export type TerminalLinkBufferCell = { getWidth?(): number; getChars?(): string }
export type TerminalLinkBufferLine = {
readonly isWrapped: boolean
readonly length: number
getCell?(x: number): TerminalLinkBufferCell | undefined
translateToString(
trimRight: boolean,
startColumn?: number,
endColumn?: number,
outColumns?: number[]
): string
}
export type TerminalLinkBuffer = { getLine(y: number): TerminalLinkBufferLine | undefined }
export type TerminalLinkBufferRange = {
start: { x: number; y: number }
end: { x: number; y: number }
}