mirror of
https://github.com/stablyai/orca.git
synced 2026-10-28 16:02:55 +00:00
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.
10 lines
519 B
TypeScript
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, '--')
|
|
}
|