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

Long code suggestions are truncated in the preview diff

Open xpgcrx opened this issue 3 months ago • 6 comments

1. Description

When I receive a long code suggestion from the Gemini CLI, the preview diff gets truncated and doesn't show the entire code block. Instead, it displays a message like ... first 132 lines hidden .... This prevents me from reviewing the full suggestion before deciding whether to apply it.

The full diff content is printed to the terminal after I either accept or discard (esc) the suggestion. However, I need to see the complete code before making that decision.

2. To Reproduce

Steps to reproduce the behavior:

  1. Run gemini in an interactive session.
  2. Enter a prompt that is expected to generate a large block of code (i.e., more lines than can fit in the current terminal window).
  3. Observe that the diff preview is truncated with a "lines hidden" message.

3. Expected Behavior

I expect to be able to view the entire code suggestion within the preview diff before applying it.

4. Environment

  • OS: macOS
  • Terminal: iTerm2
  • Multiplexer: tmux
  • gemini cli version: 0.4.0

5. Additional Context

I've noticed that if I decrease the font size in my terminal, more lines of the suggestion become visible. This suggests that the issue is related to how the content is rendered within the visible terminal area, rather than the content itself being missing.

However, constantly adjusting the font size is not a practical workaround, especially for very long code blocks. The core issue is the inability to review the complete set of changes before accepting them.

Thank you for your time and for looking into this!

xpgcrx avatar Sep 11 '25 15:09 xpgcrx

Thanks for reporting this! I am redirecting this for proper investigation!

silviojr avatar Sep 11 '25 15:09 silviojr

Hi I've marked this as a feature request since this is currently working as intended. Usually expanding the size of the terminal will also show more lines. Additionally you can see the full diff by opening in IDE etc..

srithreepo avatar Oct 02 '25 22:10 srithreepo

Hello @srithreepo, thank you so much for your response. Yeah, I noticed we can expanding the size of the terminal and see more lines. It helps a lot, but it will be a better user experience if there is a way without doing this. Today I use the CLI in a full screen and I can see a large amount of code, but when the agent changes much code in different places in the file (large files), usually the preview truncate.

I know it's possible to review the code inside an editor (usually I do this), but is much better to keep this experience at the CLI. So, it would be very nice and will improve the user experience a lot if this feature were improved.

Thanks!

ionixjunior avatar Oct 03 '25 23:10 ionixjunior

Agreed i've just been doing some small ish code changes using gemini and noticed even for adding new tests that are 10 or so lines or more its a pain to have to increase the size of the terminal particularly for one screen only coding where i have a few windows open.

I get the argument about using an IDE, but this feels to me like a work around when the default user experience is a CLI experience (and in the name of the product!). We should at least be able to scroll up and down the diff in the CLI imo if it exceeds the height of the terminal / maximum set height of the box in ink.

I'm happy to open a PR to work on this i've already been working on a PR that pretty formats JSON tool/mcp outputs - so within the same ball park.

medic-code avatar Oct 26 '25 00:10 medic-code

/assign

medic-code avatar Oct 26 '25 00:10 medic-code

There seems to have been added a shortcut (ctrl+s) to show the hidden lines in the diff, but it's a bit tedious to have to use a shortcut every time I want to review a suggested change in the CLI. I can certainly understand the idea of keeping the diff short enough to fit on the terminal, but I'd love a configuration option to have these open up full-size by default.

spencer-scw avatar Dec 10 '25 00:12 spencer-scw

Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.

It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.

Thank you for your contribution!

gemini-cli[bot] avatar Dec 14 '25 00:12 gemini-cli[bot]