mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
refactor: push isValidPath() into parsePastedPaths() (#18664)
This commit is contained in:
committed by
GitHub
parent
9e41b2cd89
commit
1b98c1f806
@@ -757,7 +757,7 @@ interface UseTextBufferProps {
|
||||
stdin?: NodeJS.ReadStream | null; // For external editor
|
||||
setRawMode?: (mode: boolean) => void; // For external editor
|
||||
onChange?: (text: string) => void; // Callback for when text changes
|
||||
isValidPath: (path: string) => boolean;
|
||||
escapePastedPaths?: boolean;
|
||||
shellModeActive?: boolean; // Whether the text buffer is in shell mode
|
||||
inputFilter?: (text: string) => string; // Optional filter for input text
|
||||
singleLine?: boolean;
|
||||
@@ -2678,7 +2678,7 @@ export function useTextBuffer({
|
||||
stdin,
|
||||
setRawMode,
|
||||
onChange,
|
||||
isValidPath,
|
||||
escapePastedPaths = false,
|
||||
shellModeActive = false,
|
||||
inputFilter,
|
||||
singleLine = false,
|
||||
@@ -2795,7 +2795,8 @@ export function useTextBuffer({
|
||||
if (
|
||||
ch.length >= minLengthToInferAsDragDrop &&
|
||||
!shellModeActive &&
|
||||
paste
|
||||
paste &&
|
||||
escapePastedPaths
|
||||
) {
|
||||
let potentialPath = ch.trim();
|
||||
const quoteMatch = potentialPath.match(/^'(.*)'$/);
|
||||
@@ -2805,7 +2806,7 @@ export function useTextBuffer({
|
||||
|
||||
potentialPath = potentialPath.trim();
|
||||
|
||||
const processed = parsePastedPaths(potentialPath, isValidPath);
|
||||
const processed = parsePastedPaths(potentialPath);
|
||||
if (processed) {
|
||||
textToInsert = processed;
|
||||
}
|
||||
@@ -2827,7 +2828,7 @@ export function useTextBuffer({
|
||||
dispatch({ type: 'insert', payload: currentText, isPaste: paste });
|
||||
}
|
||||
},
|
||||
[isValidPath, shellModeActive],
|
||||
[shellModeActive, escapePastedPaths],
|
||||
);
|
||||
|
||||
const newline = useCallback((): void => {
|
||||
|
||||
Reference in New Issue
Block a user