From 2b8a565f89f505f37a5e4f6f88dfc3a739886a01 Mon Sep 17 00:00:00 2001 From: Daniel Sibaja Date: Sat, 5 Jul 2025 16:20:12 -0600 Subject: Fix #2922: Prevent @ concatenation to valid paths in shellmode. (#2932) --- packages/cli/src/ui/components/shared/text-buffer.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/cli/src/ui/components/shared/text-buffer.ts') diff --git a/packages/cli/src/ui/components/shared/text-buffer.ts b/packages/cli/src/ui/components/shared/text-buffer.ts index 0283e059..4b7c3e79 100644 --- a/packages/cli/src/ui/components/shared/text-buffer.ts +++ b/packages/cli/src/ui/components/shared/text-buffer.ts @@ -73,6 +73,7 @@ interface UseTextBufferProps { setRawMode?: (mode: boolean) => void; // For external editor onChange?: (text: string) => void; // Callback for when text changes isValidPath: (path: string) => boolean; + shellModeActive?: boolean; // Whether the text buffer is in shell mode } interface UndoHistoryEntry { @@ -960,6 +961,7 @@ export function useTextBuffer({ setRawMode, onChange, isValidPath, + shellModeActive = false, }: UseTextBufferProps): TextBuffer { const initialState = useMemo((): TextBufferState => { const lines = initialText.split('\n'); @@ -1028,7 +1030,7 @@ export function useTextBuffer({ } const minLengthToInferAsDragDrop = 3; - if (ch.length >= minLengthToInferAsDragDrop) { + if (ch.length >= minLengthToInferAsDragDrop && !shellModeActive) { let potentialPath = ch; if ( potentialPath.length > 2 && @@ -1060,7 +1062,7 @@ export function useTextBuffer({ dispatch({ type: 'insert', payload: currentText }); } }, - [isValidPath], + [isValidPath, shellModeActive], ); const newline = useCallback((): void => { -- cgit v1.2.3