Fix #2922: Prevent @ concatenation to valid paths in shellmode. (#2932)

This commit is contained in:
Daniel Sibaja
2025-07-05 16:20:12 -06:00
committed by GitHub
parent b564d4a088
commit 2b8a565f89
3 changed files with 78 additions and 8 deletions

View File

@@ -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 => {