Table rendering is misaligned regardless of terminal width
What happened?
Description:
First off, thank you for creating such a powerful and useful tool! The Gemini CLI is a fantastic piece of work.
I've noticed a small rendering issue with tables in the terminal. When a Markdown table is displayed, the columns don't seem to align correctly, which can make them a bit tricky to read. This happens for me on both wide and narrow terminal screens.
It seems like the model is generating perfect Markdown, because when I see the same table in the web UI, it looks great. This suggests the issue might be in how the CLI client renders the Markdown for a terminal environment.
I know that getting tables to format perfectly in every terminal is a tough challenge, but I wanted to bring this to your attention in case it's helpful for future improvements. Thank you for all your hard work on this project for the good of humanity!
Steps to Reproduce:
- Run a command that displays a table, for example, by asking a question that results in a table in the response.
- Observe that the table formatting is broken, regardless of terminal width.
Actual Behavior:
The table formatting is broken, with columns becoming misaligned.
Environment:
- Gemini CLI Version: 0.1.9
- OS: All
Sample Image of Text Based Table on Gemini-Cli
Sample Image of Text Based Table on Web-Gemini (longer text with scroll bar)
Sample Image of Text Based Table on Claude-Code //First table is Broken
//Second & Third Table generated with shorter text
What did you expect to happen?
Expected Behavior:
The table should render with correct column alignment, ensuring readability.
Client information
- CLI Version: 0.1.7
- Git Commit: 55cc809
- Operating System: linux v20.19.2
- Sandbox Environment: no sandbox
- Model Version: gemini-2.5-pro
- Memory Usage: 215.2 MB
Login information
Google Account
Anything else we need to know?
No response
Looks like this issue has been fixed from v0.1.8 onwards by addition of the TableRenderer component. Ref. https://github.com/google-gemini/gemini-cli/pull/1955
However, in cases where there is a header-column and if the title is longer than the allotted width, there seems to be some misalignment issue.
The below screenshot is from version v0.1.12
Will debug to see if I can find out more.
Seems worse than that - I'm finding that the table rendering makes most of the content unreadable, in way that Gemini isn't aware of to account for. And it doesn't seem that the table cells are parsed as markdown.
- CLI Version: 0.1.13
- Git Commit: 412b78c5 (local modifications)
- Operating System: darwin v24.4.1
- Sandbox Environment: no sandbox
- Model Version: gemini-2.5-pro
- Memory Usage: 102.1 MB
I've been cooking up something: https://github.com/google-gemini/gemini-cli/pull/7526 🙂 , polishing it and handling edge cases right now.
Hey @jacob314, will you be able to review the following mrs ? they are huge improvements in markdown rendering, covered with appropriate unit tests.
- Actual bug quick fix (will be quick to review)
- Multiline rendering feature (as raised here)
let me know what you think, thanks very much !
Please talk to me first before taking on this issue. Some of the issues need to be fixed at the ink level. Believe I have the fix with a better scheme for text measurement.