feat: multi-line text answers in ask-user tool#18741
Conversation
Summary of ChangesHello @jackwotherspoon, 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 significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request successfully introduces multi-line text input capabilities for the ask_user tool, enhancing user interaction by allowing more detailed responses. It also includes proper truncation for terminal display and semantic styling for hidden lines, which improves readability. The changes are well-tested with new unit tests covering the multi-line input and truncation logic. The refactoring of TextInput submission logic to use keyMatchers is a good step towards consistency and configurability.
|
Size Change: +824 B (0%) Total Size: 24.3 MB ℹ️ View Unchanged
|
| keypressHandler({ | ||
| name: keyName, | ||
| shift: false, | ||
| alt: false, |
There was a problem hiding this comment.
why is this line in the PR? seems unrelated
There was a problem hiding this comment.
because i moved text input to look for keymatcher submit vs just "Enter" key.
So all the combos need to be set to false otherwise it thinks its a newline and not a submission.
| }} | ||
| /> | ||
| {isChecked && !question.multiSelect && ( | ||
| {isChecked && !question.multiSelect && !context.isSelected && ( |
There was a problem hiding this comment.
this fixes checkmark appearing during typing. Now only shows if you stop focus on answer (arrow up to different answer or submit to another question)
| Approves plan and allows tools to run automatically | ||
| 2. Yes, manually accept edits | ||
| Approves plan but requires confirmation for each tool | ||
| ● 3. Add tests ✓ |
There was a problem hiding this comment.
nice to see this confusing check box gone.
| const indent = ' '.repeat(prefix.length); | ||
|
|
||
| const lines = answer.split('\n'); | ||
| if (lines.length > 5) { |
There was a problem hiding this comment.
why are we truncating here? we should use MaxSizedBox at the UI layer if we really need to truncate.
There was a problem hiding this comment.
Was to keep successful tool calls in history concise and truncated, but removed it. Will follow up with proper truncation PR.

Summary
This PR enables multi-line text input for the
ask_usertool for text questions, allowing users to provide more detailed answers.Review page for ask user shows full answer, success tool call truncates after 5 lines to keep output concise.
mult-line.text.ask.user.mp4
Details
AskUserDialogto support multi-line buffers for text questions by settingsingleLine: falseand increasing the viewport height to 3 so three lines are shown.TextInputsubmission logic to useCommand.SUBMITmatcher.Enternow submits, while shortcuts likeShift+Enter,Ctrl+Enter, andCtrl+Jcorrectly insert newlines.ask_usertool output (Core), ensuring they align with the first line's starting position (after the header and arrow).... x more lines hiddenmessage.<secondary>tag in theInlineMarkdownRendererto support themed dimmed text.Related Issues
Fixes #18328
How to Validate
ask_usercall with atexttype question.Shift+EnterorCtrl+Jto insert multiple newlines.... 2 more lines hiddenmessage.npm test -w @google/gemini-cli-core -- src/tools/ask-user.test.tsnpm test -w @google/gemini-cli -- src/ui/utils/InlineMarkdownRenderer.test.ts src/ui/utils/MarkdownDisplay.test.tsxPre-Merge Checklist