Skip to content

Expand pasted text placeholders in AskUserDialog and InputPrompt#19286

Closed
korade-krushna wants to merge 5 commits intogoogle-gemini:mainfrom
korade-krushna:fix/ask-user-tool-input
Closed

Expand pasted text placeholders in AskUserDialog and InputPrompt#19286
korade-krushna wants to merge 5 commits intogoogle-gemini:mainfrom
korade-krushna:fix/ask-user-tool-input

Conversation

@korade-krushna
Copy link
Copy Markdown
Contributor

@korade-krushna korade-krushna commented Feb 17, 2026

Summary

This PR fixes a bug where large pasted text in the AskUserDialog was submitted as a collapsed placeholder string (e.g., [Pasted Text: 19 lines]) instead of the actual content. It also centralizes the paste expansion logic into a shared utility.

Details

  • New Shared Utility: Introduced expandPastedContent in text-buffer.ts to consistently replace paste placeholders with their original content.
  • Component Refactoring:
    • Updated InputPrompt.tsx to use the new utility, removing duplicate inline logic.
    • Updated AskUserDialog.tsx to ensure both TEXT questions and CHOICE question custom options correctly expand pasted content before submission.
  • Enhanced Testing: Added new test cases to AskUserDialog.test.tsx specifically targeting paste expansion scenarios.

Related Issues

Fixes #19238

How to Validate

  1. Run the specialized unit tests for these components:
   npm test -w @google/gemini-cli -- src/ui/components/InputPrompt.test.tsx src/ui/components/AskUserDialog.test.tsx

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@korade-krushna korade-krushna requested a review from a team as a code owner February 17, 2026 21:40
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @korade-krushna, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a bug where large pasted text in user input fields was being submitted as a collapsed placeholder string instead of its actual content. The solution centralizes the logic for expanding these placeholders into a reusable utility, which is then integrated into the AskUserDialog and InputPrompt components. This ensures that all user-pasted content is accurately processed and submitted, enhancing the reliability and user experience of text input.

Highlights

  • Centralized Paste Expansion Logic: A new shared utility function, expandPastedContent, was introduced to consistently replace paste placeholders with their original content across the application.
  • Component Refactoring: The InputPrompt.tsx component was updated to use the new expandPastedContent utility, removing duplicate inline logic. AskUserDialog.tsx was also updated to ensure pasted content is correctly expanded for both TEXT questions and custom options in CHOICE questions before submission.
  • Enhanced Testing: New test cases were added to AskUserDialog.test.tsx specifically targeting scenarios where large pasted text needs to be expanded in TEXT questions and CHOICE question custom options.
Changelog
  • packages/cli/src/ui/components/AskUserDialog.test.tsx
    • Added test cases to verify that large pasted text in TEXT questions is submitted as expanded content.
    • Added test cases to verify that large pasted text in CHOICE question custom options is submitted as expanded content.
  • packages/cli/src/ui/components/AskUserDialog.tsx
    • Imported the new expandPastedContent utility.
    • Modified TextQuestionView to use expandPastedContent before submitting answers.
    • Modified ChoiceQuestionView to use expandPastedContent for custom options in both multi-select and single-select scenarios.
    • Updated dependencies for useCallback hooks to include customBuffer.pastedContent.
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Removed the old inline logic for expanding pasted text.
    • Imported and utilized the new expandPastedContent utility for processing submitted values.
  • packages/cli/src/ui/components/shared/text-buffer.ts
    • Introduced a new expandPastedContent function to replace placeholder strings with their actual content.
Activity
  • The author provided a detailed summary outlining the bug fix, the introduction of a new shared utility, component refactoring, and enhanced testing.
  • This pull request addresses and fixes issue Collapsed paste doesn't work in Ask User #19238.
  • Validation steps, including specific unit tests to run, have been provided for reviewers.
  • The pre-merge checklist indicates that tests have been added/updated and validated on MacOS using npm run and npx.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves the issue of unexpanded pasted text in AskUserDialog by centralizing the expansion logic into a new expandPastedContent utility. The refactoring in AskUserDialog and InputPrompt to use this shared function is clean and improves code maintainability. The addition of specific test cases for paste expansion scenarios is also a great enhancement, ensuring the fix is robust. Overall, this is a well-executed change that improves both functionality and code quality.

@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Feb 17, 2026
@jackwotherspoon
Copy link
Copy Markdown
Collaborator

Hey @korade-krushna i accidentally reviewed #19946 before getting to this one, my apologies!

Looks like both are accomplishing the same end goal. So going to close this one, but next time i will be more diligent in taking a look at PRs opened first. 👍

@korade-krushna
Copy link
Copy Markdown
Contributor Author

No Worries @jackwotherspoon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapsed paste doesn't work in Ask User

2 participants