mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 16:02:42 +00:00
Improve terminal input redraw latency
Keep terminal UI drawing glyphs on WebGL and bypass daemon stream batching for small redraws immediately after terminal input.
This commit is contained in:
@@ -2102,6 +2102,31 @@ describe('connectPanePty', () => {
|
||||
expect(pane.terminal.write).toHaveBeenCalledWith('Arabic: السلام عليكم\r\n')
|
||||
})
|
||||
|
||||
it('keeps panes on WebGL for terminal UI drawing glyphs', async () => {
|
||||
const { connectPanePty } = await import('./pty-connection')
|
||||
const transport = createMockTransport()
|
||||
const capturedDataCallback: { current: ((data: string) => void) | null } = { current: null }
|
||||
transport.connect.mockImplementation(async ({ callbacks }: { callbacks: ConnectCallbacks }) => {
|
||||
capturedDataCallback.current = callbacks.onData ?? null
|
||||
return 'pty-id'
|
||||
})
|
||||
transportFactoryQueue.push(transport)
|
||||
|
||||
const pane = createPane(1)
|
||||
const manager = createManager(1)
|
||||
const deps = createDeps()
|
||||
|
||||
connectPanePty(pane as never, manager as never, deps as never)
|
||||
await flushAsyncTicks(6)
|
||||
|
||||
capturedDataCallback.current?.('⠋ Working ├─ file.ts █ progress \uE0B0 prompt\r\n')
|
||||
|
||||
expect(manager.markPaneHasComplexScriptOutput).not.toHaveBeenCalled()
|
||||
expect(pane.terminal.write).toHaveBeenCalledWith(
|
||||
'⠋ Working ├─ file.ts █ progress \uE0B0 prompt\r\n'
|
||||
)
|
||||
})
|
||||
|
||||
it('reattaches via daemon sessionId when an in-session PTY is live', async () => {
|
||||
const { connectPanePty } = await import('./pty-connection')
|
||||
const transport = createMockTransport()
|
||||
|
||||
@@ -19,12 +19,15 @@ describe('terminalOutputPrefersDomRenderer', () => {
|
||||
expect(terminalOutputPrefersDomRenderer('Fullwidth: ABC123')).toBe(true)
|
||||
})
|
||||
|
||||
it('detects glyph classes common in agent terminal UIs', () => {
|
||||
expect(terminalOutputPrefersDomRenderer('⠋ Working')).toBe(true)
|
||||
expect(terminalOutputPrefersDomRenderer('├─ file.ts')).toBe(true)
|
||||
expect(terminalOutputPrefersDomRenderer('█ progress')).toBe(true)
|
||||
expect(terminalOutputPrefersDomRenderer('◆ status')).toBe(true)
|
||||
expect(terminalOutputPrefersDomRenderer('\uE0B0 prompt')).toBe(true)
|
||||
it('keeps terminal drawing glyphs on WebGL', () => {
|
||||
expect(terminalOutputPrefersDomRenderer('⠋ Working')).toBe(false)
|
||||
expect(terminalOutputPrefersDomRenderer('├─ file.ts')).toBe(false)
|
||||
expect(terminalOutputPrefersDomRenderer('█ progress')).toBe(false)
|
||||
expect(terminalOutputPrefersDomRenderer('◆ status')).toBe(false)
|
||||
expect(terminalOutputPrefersDomRenderer('\uE0B0 prompt')).toBe(false)
|
||||
})
|
||||
|
||||
it('detects malformed replacement characters', () => {
|
||||
expect(terminalOutputPrefersDomRenderer('bad replacement �')).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Why: xterm WebGL renders from a glyph atlas; agent TUIs often combine glyphs
|
||||
// that are safer through the browser text path even when they are not RTL.
|
||||
// Why: xterm WebGL renders from a glyph atlas; actual complex text is safer
|
||||
// through the browser text path. Terminal UI drawing glyphs stay on WebGL
|
||||
// because xterm's custom-glyph renderer is built for those ranges.
|
||||
const EMOJI_PRESENTATION_PATTERN = /\p{Emoji_Presentation}/u
|
||||
|
||||
function isInRange(value: number, start: number, end: number): boolean {
|
||||
@@ -11,16 +12,12 @@ function isRendererRiskCodePoint(value: number): boolean {
|
||||
isInRange(value, 0x0590, 0x08ff) ||
|
||||
value === 0x200d ||
|
||||
isInRange(value, 0x1100, 0x11ff) ||
|
||||
isInRange(value, 0x2500, 0x259f) ||
|
||||
isInRange(value, 0x25a0, 0x25ff) ||
|
||||
isInRange(value, 0x2800, 0x28ff) ||
|
||||
// Why: xterm WebGL can leave stale atlas cells for East Asian wide glyphs
|
||||
// on Windows; force browser text rendering before long CJK output paints.
|
||||
isInRange(value, 0x2e80, 0x9fff) ||
|
||||
isInRange(value, 0xa960, 0xa97f) ||
|
||||
isInRange(value, 0xac00, 0xd7ff) ||
|
||||
isInRange(value, 0xd800, 0xdfff) ||
|
||||
isInRange(value, 0xe000, 0xf8ff) ||
|
||||
isInRange(value, 0xf900, 0xfaff) ||
|
||||
isInRange(value, 0xfe10, 0xfe1f) ||
|
||||
isInRange(value, 0xfe30, 0xfe4f) ||
|
||||
|
||||
Reference in New Issue
Block a user