From 6a200e462255da17ae3c7d84966a2cbfb89c7682 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Thu, 13 Aug 2026 14:05:03 +0300 Subject: [PATCH] fix(chat): preserve repeated shell prefixes --- packages/ui/src/components/chat/ChatInput.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) 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);