Files
orca/mobile/src/terminal/terminal-text-input-normalization.ts
T
Jinjing 3a7eb8f312 fix(mobile): drop smart-dash write-back recovery that kills iOS dictation (#8008)
The longer-hyphen recovery path (#5222) reconstructed runs by writing a
value that differed from the native field text. After #7933 stores raw
field text and normalizes only on send/PTY, that recovery is unreachable
and any write-back would reintroduce dictation kill. Map each smart dash
to exactly "--" with a single-arg normalizer.
2026-07-09 20:38:17 -07:00

10 lines
519 B
TypeScript

// Why: iOS smart punctuation can rewrite two ASCII hyphens into a single
// Unicode dash before React Native delivers terminal text input. Each dash maps
// to exactly "--": recovering longer runs (#5222) needed the previous controlled
// value written back into the field, and that write-back kills iOS dictation (#7925).
const IOS_SMART_DASH_REPLACEMENT_PATTERN = /[\u2013\u2014]/g
export function normalizeTerminalTextInput(text: string): string {
return text.replace(IOS_SMART_DASH_REPLACEMENT_PATTERN, '--')
}