fix(chat): preserve repeated shell prefixes
This commit is contained in:
@@ -283,6 +283,7 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({ onOpenSettings, scrollTo
|
||||
const suppressNextFileDropTextInsertTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const suppressNextFileMentionPasteRef = React.useRef(false);
|
||||
const suppressNextFileMentionPasteTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const shellTriggerNormalizationRef = React.useRef(false);
|
||||
const pendingDroppedAbsolutePathsRef = React.useRef<string[]>([]);
|
||||
const canAcceptDropRef = React.useRef(false);
|
||||
const mentionRef = React.useRef<FileMentionHandle>(null);
|
||||
@@ -1729,6 +1730,12 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({ 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<ChatInputProps> = ({ onOpenSettings, scrollTo
|
||||
closeAutocomplete();
|
||||
const editor = composerRef.current;
|
||||
if (editor) {
|
||||
shellTriggerNormalizationRef.current = true;
|
||||
editor.replaceRange(0, 1, '', nextCursor);
|
||||
} else {
|
||||
setMessage(shellCommand);
|
||||
|
||||
Reference in New Issue
Block a user