mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
* 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.
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { joinAbsolutePath, resolveTildePath } from './terminal-path-normalization'
|
|
|
|
describe('joinAbsolutePath', () => {
|
|
it.each([
|
|
['/repo', '../sibling/readme.md', '/sibling/readme.md'],
|
|
['/repo/worktree', '../../sibling/readme.md', '/sibling/readme.md'],
|
|
['/repo/worktree', 'src/../../readme.md', '/repo/readme.md'],
|
|
['/repo/./worktree/..', '../sibling/readme.md', '/sibling/readme.md'],
|
|
['/repo', '../../../readme.md', '/readme.md'],
|
|
['/repo', '..', '/'],
|
|
['/', '../../readme.md', '/readme.md'],
|
|
['/', '', '/'],
|
|
['/', '/readme.md', '/readme.md'],
|
|
[String.raw`c:\repo\worktree`, String.raw`..\sibling\readme.md`, 'C:/repo/sibling/readme.md'],
|
|
['C:/repo/worktree', '../../../readme.md', 'C:/readme.md'],
|
|
['C:/repo', '..', 'C:/'],
|
|
['C:/', '../readme.md', 'C:/readme.md'],
|
|
['C:/', '', 'C:/'],
|
|
[
|
|
String.raw`\\server\share\repo`,
|
|
String.raw`..\sibling\readme.md`,
|
|
'//server/share/sibling/readme.md'
|
|
],
|
|
['//server/share/repo', '../../../readme.md', '//server/share/readme.md'],
|
|
['//server/share/repo', '..', '//server/share'],
|
|
['//server/share', '../../readme.md', '//server/share/readme.md'],
|
|
['//server/share', '', '//server/share']
|
|
])('joins %j and %j without escaping its filesystem root', (base, relative, expected) => {
|
|
expect(joinAbsolutePath(base, relative)).toBe(expected)
|
|
})
|
|
|
|
it('cannot resolve a relative base', () => {
|
|
expect(joinAbsolutePath('repo', '../readme.md')).toBeNull()
|
|
})
|
|
})
|
|
|
|
describe('resolveTildePath', () => {
|
|
it('resolves parent segments against an inferred home', () => {
|
|
expect(resolveTildePath('~/../shared/readme.md', '/home/me/repo')).toBe(
|
|
'/home/shared/readme.md'
|
|
)
|
|
})
|
|
|
|
it('retains the drive root when traversing beyond an explicit home', () => {
|
|
expect(resolveTildePath('~/../../../readme.md', 'C:/repo', 'C:/Users/me')).toBe('C:/readme.md')
|
|
})
|
|
})
|