Skip to content

fix(cli): correct shell height reporting#21492

Merged
jacob314 merged 3 commits intomainfrom
shell_size
Mar 7, 2026
Merged

fix(cli): correct shell height reporting#21492
jacob314 merged 3 commits intomainfrom
shell_size

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Mar 6, 2026

Summary

Shells are now rendered in a small box in Gemini CLI but we were still telling nodepty that they had
a much larger height making them unusable.

Details

Report the correct height and width and simplify so reporting is done from the UI components
themselves rather than AppContainer. The logic has been correctly relocated to ShellToolMessage.tsx.

Related Issues

Fixes #21494

How to Validate

Run vim, gemini or other interactive apps from with the embedded shells. Verify that the shell now
renders at the expected height and width.

@jacob314 jacob314 requested a review from a team as a code owner March 6, 2026 23:54
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Mar 6, 2026

Hi @jacob314, 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!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 refines the terminal UI's shell height management to ensure accurate display and interaction. It introduces a more precise calculation for the available vertical space within the shell, accounting for UI elements like borders and headers. This change centralizes the PTY resizing logic, leading to a more robust and predictable user experience, especially when dealing with varying terminal sizes and shell outputs.

Highlights

  • Improved Shell Height Calculation: The system now accurately accounts for UI overhead, such as borders and titles, when determining the available height for shell content, preventing display issues.
  • Refactored PTY Resizing Logic: The logic for resizing the pseudo-terminal (PTY) has been centralized within the ShellToolMessage component, ensuring consistent and correct shell dimensions during execution.
  • Enhanced Text Wrapping in ANSI Output: Text within ANSI output is now configured to wrap, improving readability for long lines of shell output.
  • Removed Redundant Tests: Outdated test blocks related to previous terminal height calculation and shell interaction logic have been removed, streamlining the test suite.
Changelog
  • packages/cli/src/ui/AppContainer.test.tsx
    • Removed unused imports related to terminal size and shell execution.
    • Deleted test blocks for 'Terminal Height Calculation' and 'Shell Interaction'.
  • packages/cli/src/ui/AppContainer.tsx
    • Removed a useEffect hook responsible for resizing the PTY based on terminal dimensions.
  • packages/cli/src/ui/components/AnsiOutput.tsx
    • Enabled text wrapping for AnsiLineText component to improve display of long lines.
  • packages/cli/src/ui/components/snapshots/AskUserDialog.test.tsx.snap
    • Updated test snapshots for AskUserDialog to reflect changes in interaction instructions and removed redundant warning messages.
  • packages/cli/src/ui/components/messages/ShellToolMessage.test.tsx
    • Adjusted expected maximum line calculations and assertions in ShellToolMessage tests to account for new shell content overhead.
  • packages/cli/src/ui/components/messages/ShellToolMessage.tsx
    • Added imports for ShellExecutionService, CoreToolCallStatus, calculateToolContentMaxLines, and SHELL_CONTENT_OVERHEAD.
    • Introduced a new useEffect hook to handle PTY resizing for executing shells, calculating childWidth and finalHeight.
    • Refactored maxLines calculation to use a new maxLines constant.
  • packages/cli/src/ui/utils/toolLayoutUtils.ts
    • Introduced SHELL_CONTENT_OVERHEAD constant to define vertical space consumed by shell UI elements.
    • Updated calculateShellMaxLines to factor in SHELL_CONTENT_OVERHEAD for more accurate shell height calculations in various scenarios.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli gemini-cli bot added the priority/p1 Important and should be addressed in the near term. label Mar 6, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the shell height calculation and PTY resizing logic, moving it from AppContainer to the more specialized ShellToolMessage component. This is a positive change for modularity. The introduction of a constant for UI overhead is also a good step towards fixing height miscalculations. However, I've identified a critical issue where inconsistent height calculation methods are used for the display component and the underlying PTY, which could lead to UI rendering bugs. My review includes a suggestion to resolve this inconsistency, aligning with our guidelines for maintaining layout consistency.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Size Change: +345 B (0%)

Total Size: 26 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.5 MB +345 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Mar 7, 2026
@jacob314 jacob314 changed the title Fix so shell height is correctly reported. fix(cli): correct shell height reporting Mar 7, 2026
@jacob314 jacob314 added this pull request to the merge queue Mar 7, 2026
Merged via the queue into main with commit e89cf5d Mar 7, 2026
27 checks passed
@jacob314 jacob314 deleted the shell_size branch March 7, 2026 19:49
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive shells are sized incorrectly

2 participants