-
-
Notifications
You must be signed in to change notification settings - Fork 795
Fix stale output when outputHeight changes from above stdout.rows to below stdout.rows #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sindresorhus
merged 5 commits into
vadimdemedes:master
from
thkim1011:tae/fix-renders-for-long-output
May 29, 2025
Merged
Fix stale output when outputHeight changes from above stdout.rows to below stdout.rows #717
sindresorhus
merged 5 commits into
vadimdemedes:master
from
thkim1011:tae/fix-renders-for-long-output
May 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thkim1011
commented
May 8, 2025
| const customGlobal = global as any; | ||
|
|
||
| // These things must exist before importing `react-devtools-core` | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear why this lint error just started to appear, but should be safe to ignore.
Contributor
Author
|
Correct me if I'm wrong but I think my PR fixes #585. |
Contributor
Author
|
@sindresorhus can I get a re-run of the ci? |
Contributor
Author
|
@sindresorhus just a heads up that this is ready for review. |
NTaylorMullen
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
May 16, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
NTaylorMullen
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
May 16, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
keithballinger
pushed a commit
to google-gemini/gemini-cli
that referenced
this pull request
Jun 13, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
elminramazanov
pushed a commit
to elminramazanov/claimfront
that referenced
this pull request
Jun 25, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
viridivn
pushed a commit
to viridivn/gemini-cli
that referenced
this pull request
Jun 29, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
happy-dev100
added a commit
to happy-dev100/gemini
that referenced
this pull request
Sep 19, 2025
This commit introduces several changes to better manage terminal height and prevent UI tearing, especially when displaying long tool outputs or when the pending history item exceeds the available terminal height. - Calculate and utilize available terminal height in `App.tsx`, `HistoryItemDisplay.tsx`, `ToolGroupMessage.tsx`, and `ToolMessage.tsx`. - Refresh the static display area in `App.tsx` when a pending history item is too large, working around an Ink bug (see vadimdemedes/ink#717). - Truncate long tool output in `ToolMessage.tsx` and indicate the number of hidden lines. - Refactor `App.tsx` to correctly measure and account for footer height. Fixes https://b.corp.google.com/issues/414196943
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the outputHeight goes from a value
>= stdout.rowsto a value< stdout.rowsin between re-render, it is possible that the old content is not completely removed from the terminal.This happens for three reasons
height >= stdout.rows, but we only need to clear the previous render's output, there's no point in writingansiEscapes.clearTerminal. Similarly, if the current output has aheight < stdout.rowsbut the previous output exceededstdout.rows, then writingansiEscapes.eraseLines(previousLineCount)won't clear all of the old output.this.log.clear()doesn't actually track the height of the output if we rendered via theoutputHeight >= this.options.stdout.rowsconditional. I've added a helperLogUpdate.syncto keep it in sync.outputHeight >= this.options.stdout.rowsconditional differs slightly in behavior tothis.login that it does not append a newline at the end.Addressing all three of these points fixes the bug.
To test, I verified locally using a small example, and I've also added a test (see "erase screen where state changes in small viewport") which fails on master but passes in this branch.
Fixes #585