fix: expand paste placeholders in TextInput on submit (#19946)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Jeffrey Ying
2026-03-06 22:29:38 -05:00
committed by GitHub
parent 9a7427197b
commit 0fd09e0150
7 changed files with 149 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ import { HalfLinePaddedBox } from './shared/HalfLinePaddedBox.js';
import {
type TextBuffer,
logicalPosToOffset,
PASTED_TEXT_PLACEHOLDER_REGEX,
expandPastePlaceholders,
getTransformUnderCursor,
LARGE_PASTE_LINE_THRESHOLD,
LARGE_PASTE_CHAR_THRESHOLD,
@@ -346,10 +346,9 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
(submittedValue: string) => {
let processedValue = submittedValue;
if (buffer.pastedContent) {
// Replace placeholders like [Pasted Text: 6 lines] with actual content
processedValue = processedValue.replace(
PASTED_TEXT_PLACEHOLDER_REGEX,
(match) => buffer.pastedContent[match] || match,
processedValue = expandPastePlaceholders(
processedValue,
buffer.pastedContent,
);
}