Replace the legacy terminal flow with a shared authenticated WebSocket runtime used across web, desktop, relay, and mobile surfaces. - introduce the v3 terminal protocol with scoped attachments, snapshots, ordered output, bounded replay history, reconnects, and explicit lifecycle - harden PTY creation, restart, resize, close, force-kill, idle cleanup, shell selection, login mode, environment sanitization, and appearance sync - add runtime-aware terminal APIs with relay authentication and Electron parity - add a fullscreen mobile terminal workspace with touch scrolling, long-press selection, safe-area controls, quick keys, and Ctrl/Alt input - add terminal selection attachments, preview detection, project actions, shell settings, and localized UI - harden Ghostty rendering, resize recovery, Unicode handling, block characters, line height, and stale-row behavior - remove the obsolete terminal SSE path and update reverse-proxy guidance - expand terminal runtime, transport, input, selection, and store coverage - avoid duplicate web builds when preparing mobile assets in root CI builds
17 lines
887 B
TypeScript
17 lines
887 B
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { applyTerminalModifier, terminalControlCharacter, terminalSequenceForKey } from './terminalInput';
|
|
|
|
describe('terminal input translation', () => {
|
|
test('translates navigation, editing, and control keys', () => {
|
|
expect(terminalSequenceForKey('arrow-up', null)).toBe('\u001b[A');
|
|
expect(terminalSequenceForKey('arrow-left', 'ctrl')).toBe('\u001b[1;5D');
|
|
expect(terminalSequenceForKey('arrow-right', 'alt')).toBe('\u001b[1;3C');
|
|
expect(terminalSequenceForKey('enter', null)).toBe('\r');
|
|
expect(terminalControlCharacter('c')).toBe('\u0003');
|
|
expect(terminalControlCharacter('[')).toBeNull();
|
|
expect(applyTerminalModifier('c', 'ctrl')).toBe('\u0003');
|
|
expect(applyTerminalModifier('b', 'alt')).toBe('\u001bb');
|
|
expect(applyTerminalModifier('\u001b[1;3C', 'alt')).toBe('\u001b[1;3C');
|
|
});
|
|
});
|