Skip to content

Commit 785b033

Browse files
committed
🤖 fix: prevent escape from interrupting stream during message editing
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 ad7e163 commit 785b033

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"lockfileVersion": 1,
3+
"configVersion": 0,
34
"workspaces": {
45
"": {
56
"name": "mux",

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)