diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index 232ea5f4..5ff1d8ab 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -283,6 +283,7 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo const suppressNextFileDropTextInsertTimeoutRef = React.useRef | null>(null); const suppressNextFileMentionPasteRef = React.useRef(false); const suppressNextFileMentionPasteTimeoutRef = React.useRef | null>(null); + const shellTriggerNormalizationRef = React.useRef(false); const pendingDroppedAbsolutePathsRef = React.useRef([]); const canAcceptDropRef = React.useRef(false); const mentionRef = React.useRef(null); @@ -1729,6 +1730,12 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo }, []); const handleComposerChange = ({ value, selection, fromPaste, insertedText }: ComposerChange) => { + if (shellTriggerNormalizationRef.current) { + shellTriggerNormalizationRef.current = false; + setMessage(value); + return; + } + // VS Code drops the dragged path as text as well as firing the drop // handler; swallow that duplicate insertion. if (isVSCodeRuntime() && suppressNextFileDropTextInsertRef.current) { @@ -1757,6 +1764,7 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo closeAutocomplete(); const editor = composerRef.current; if (editor) { + shellTriggerNormalizationRef.current = true; editor.replaceRange(0, 1, '', nextCursor); } else { setMessage(shellCommand);