Skip to content

Commit c80f3d3

Browse files
🤖 fix: prevent escape from interrupting stream during message editing (#1010)
When editing a message while streaming, pressing Escape to cancel editing would also interrupt the active stream. This is the same issue fixed in PR #954 for workspace renaming. Added `stopPropagation()` in both code paths: - Non-vim mode: ChatInput's CANCEL_EDIT handler - Vim mode: VimTextArea's escapeInNormalMode handler This prevents the Escape keydown event from reaching the global stream interrupt handler in `useAIViewKeybinds`. _Generated with `mux`_
1 parent e07ef9d commit c80f3d3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

‎src/browser/components/ChatInput/index.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
12311231
if (matchesKeybind(e, KEYBINDS.CANCEL_EDIT)) {
12321232
if (variant === "workspace" && editingMessage && props.onCancelEdit && !vimEnabled) {
12331233
e.preventDefault();
1234+
e.stopPropagation(); // Prevent global handler from interrupting stream
12341235
setDraft(preEditDraftRef.current);
12351236
props.onCancelEdit();
12361237
const isFocused = document.activeElement === inputRef.current;

‎src/browser/components/VimTextArea.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export const VimTextArea = React.forwardRef<HTMLTextAreaElement, VimTextAreaProp
166166
return;
167167
}
168168
if (result.action === "escapeInNormalMode") {
169+
e.stopPropagation(); // Prevent global handler from interrupting stream
169170
onEscapeInNormalMode?.();
170171
return;
171172
}

0 commit comments

Comments
 (0)