@miphamai/cli 0.32.5 → 0.32.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ui/input.tsx +5 -2
package/package.json
CHANGED
package/src/ui/input.tsx
CHANGED
|
@@ -398,13 +398,16 @@ export function InputBar({
|
|
|
398
398
|
historyIndexRef.current = -1
|
|
399
399
|
savedDraftRef.current = ''
|
|
400
400
|
}
|
|
401
|
+
// Normalize newlines → spaces. ink-text-input is single-line; multi-line
|
|
402
|
+
// paste would trap arrow-key navigation on the first line.
|
|
403
|
+
const normalized = val.replace(/\n/g, ' ')
|
|
401
404
|
// Throttle: first keystroke renders immediately, then batch at ~30fps.
|
|
402
405
|
// During paste, the terminal may send hundreds of characters in rapid
|
|
403
406
|
// succession — without throttling, each triggers a React render+Ink write
|
|
404
407
|
// cycle that starves the event loop and freezes the UI.
|
|
405
|
-
valueRef.current =
|
|
408
|
+
valueRef.current = normalized
|
|
406
409
|
if (onChangeTimerRef.current) return // timer pending, latest value in ref
|
|
407
|
-
setValue(
|
|
410
|
+
setValue(normalized)
|
|
408
411
|
onChangeTimerRef.current = setTimeout(() => {
|
|
409
412
|
onChangeTimerRef.current = null
|
|
410
413
|
setValue(valueRef.current)
|