gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Table rendering is misaligned regardless of terminal width

Open chingchun94 opened this issue 1 year ago • 5 comments

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:

  1. Run a command that displays a table, for example, by asking a question that results in a table in the response.
  2. 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 Image

Sample Image of Text Based Table on Web-Gemini (longer text with scroll bar)

Image

Sample Image of Text Based Table on Claude-Code //First table is Broken

Image

//Second & Third Table generated with shorter text

Image

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

chingchun94 avatar Jul 03 '25 13:07 chingchun94

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

Image

Will debug to see if I can find out more.

gokullan avatar Jul 20 '25 13:07 gokullan

Image

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

rossjrw avatar Jul 23 '25 08:07 rossjrw

I've been cooking up something: https://github.com/google-gemini/gemini-cli/pull/7526 🙂 , polishing it and handling edge cases right now.

dumbbellcode avatar Aug 31 '25 22:08 dumbbellcode

Hey @jacob314, will you be able to review the following mrs ? they are huge improvements in markdown rendering, covered with appropriate unit tests.

  1. Actual bug quick fix (will be quick to review)
  2. Multiline rendering feature (as raised here)

let me know what you think, thanks very much !

dumbbellcode avatar Sep 12 '25 13:09 dumbbellcode

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.

jacob314 avatar Oct 08 '25 15:10 jacob314