Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hooks/useAIViewKeybinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ export function useAIViewKeybinds({
}

// Normal stream interrupt (non-compaction)
// Allow interrupt in editable elements if there's no text selection
// Check for text selection anywhere - only interrupt if nothing is selected
// This way Ctrl+C works for both copy (when text is selected) and interrupt (when not)
const inEditableElement = isEditableElement(e.target);
let hasSelection = false;

if (inEditableElement) {
if (isEditableElement(e.target)) {
// For input/textarea elements, check selectionStart/selectionEnd
// (window.getSelection() doesn't work for form elements)
const target = e.target as HTMLInputElement | HTMLTextAreaElement;
Expand All @@ -85,7 +84,8 @@ export function useAIViewKeybinds({
hasSelection = (window.getSelection()?.toString().length ?? 0) > 0;
}

if ((canInterrupt || showRetryBarrier) && (!inEditableElement || !hasSelection)) {
// Only interrupt if there's no selection (allow Ctrl+C to copy when text is selected)
if ((canInterrupt || showRetryBarrier) && !hasSelection) {
e.preventDefault();
setAutoRetry(false); // User explicitly stopped - don't auto-retry
void window.api.workspace.interruptStream(workspaceId);
Expand Down