fix: character truncation in raw markdown mode#18938
Conversation
|
Hi @jackwotherspoon, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
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 addresses a visual bug in the raw markdown display mode where text was being cut off at the right edge of the terminal. The fix ensures that the available width for rendering markdown content correctly accounts for a fixed-width prefix, preventing truncation and improving the readability of raw markdown output. 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
|
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding How to link an issue: Thank you for your understanding and for being a part of our community! |
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a character truncation issue in raw markdown mode by accounting for the prefix width when calculating the available terminal width. The included review comments suggest clamping the calculated width to a minimum of zero, which prevents potential rendering issues or crashes in the edge case of a very narrow terminal window, thereby improving the robustness of the fix.
packages/cli/src/ui/components/messages/GeminiMessageContent.tsx
Outdated
Show resolved
Hide resolved
|
Size Change: +82 B (0%) Total Size: 24.3 MB ℹ️ View Unchanged
|

Summary
✦) fromterminalWidthbefore passing it toMarkdownDisplayin bothGeminiMessageandGeminiMessageContentProblem
When toggling raw markdown mode, text at the right edge of the terminal gets truncated (e.g., "remaining" becomes "remaini"). This happens because
MarkdownDisplayreceives the fullterminalWidthbut the parent layout already reserves 2 characters for the✦prefix. Raw markdown mode then calculatesmaxWidth = terminalWidth - 1(for code block padding), but onlyterminalWidth - 2characters are actually available, causing overflow and truncation.Rendered markdown is unaffected because
<Text wrap="wrap">respects the flex container's actual width. Raw markdown mode uses an explicitwidth={maxWidth}on a Box, which overflows the container.Changes
GeminiMessage.tsx— passterminalWidth - prefixWidthinstead ofterminalWidthtoMarkdownDisplayGeminiMessageContent.tsx— same fixPre-Merge Checklist