fix: prevent escape character from being inserted into input
Strip escape characters in PasteAwareTextInput handleChange to prevent them from being inserted by ink-text-input. This was causing the 'Press Esc again to clear' hint to flicker and disappear immediately because the value change triggered the useEffect that resets escapePressed. Also extracted the double-escape window duration to a constant (2.5s). 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta <noreply@letta.com>
This commit is contained in:
@@ -20,6 +20,8 @@ const appVersion = getVersion();
|
||||
|
||||
// Only show token count when it exceeds this threshold
|
||||
const COUNTER_VISIBLE_THRESHOLD = 1000;
|
||||
// Window for double-escape to clear input
|
||||
const ESC_CLEAR_WINDOW_MS = 2500;
|
||||
|
||||
export function Input({
|
||||
visible = true,
|
||||
@@ -164,12 +166,12 @@ export function Input({
|
||||
setEscapePressed(false);
|
||||
if (escapeTimerRef.current) clearTimeout(escapeTimerRef.current);
|
||||
} else {
|
||||
// First escape - start 1-second timer
|
||||
// First escape - start timer to allow double-escape to clear
|
||||
setEscapePressed(true);
|
||||
if (escapeTimerRef.current) clearTimeout(escapeTimerRef.current);
|
||||
escapeTimerRef.current = setTimeout(() => {
|
||||
setEscapePressed(false);
|
||||
}, 1000);
|
||||
}, ESC_CLEAR_WINDOW_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user