Skip to content

fix(ui): unify Ctrl+O expansion hint experience across buffer modes#21474

Merged
jacob314 merged 3 commits intomainfrom
feature/consolidate-overflow-hints
Mar 7, 2026
Merged

fix(ui): unify Ctrl+O expansion hint experience across buffer modes#21474
jacob314 merged 3 commits intomainfrom
feature/consolidate-overflow-hints

Conversation

@jwhelangoog
Copy link
Contributor

Summary

This PR unifies the Ctrl+O expansion hint experience between the Standard Terminal and Alternate Screen Buffer (ASB) modes.

  • Overflow: The centralized 'Ctrl+O' hint within the ToastDisplay of the Composer is now trigger for overflowing views that appear within output history stream for standard and ASB modes (For ASB, all inline hints have been removed.)
  • Contextual UI: Isolated inline hints (eg the ShowMoreLines comp) are maintained for contextual UI components (such as Tool Confirmation views) in both modes.
  • Scrollable Components in ASB: Added opt-in global overflow reporting for ASB scrollable components, ensuring that individual tool results trigger the global hint without the main history scrollback causing "hint spam".

Details

  • Removed local hasOverflow calculations, useEffect hooks, and the local ShowMoreLines component rendering from ToolGroupMessage.tsx.
  • Delegated overflow reporting to its child components (ToolResultDisplay -> Scrollable/MaxSizedBox), allowing overflow events to bubble up to the global AppContainer.
  • Added a reportOverflow prop to Scrollable.tsx to handle opt-in global overflow reporting via useOverflowActions.
  • Passed reportOverflow={true} to the Scrollable component instance in ToolResultDisplay.tsx.
  • Updated test assertions in AppContainer.test.tsx to use waitFor to handle React's asynchronous state flush in ASB mode correctly.
  • Updated MainContent.test.tsx snapshots to reflect the intended removal of the local ShowMoreLines component.

Related Issues

Fixes #20455

How to Validate

  1. Run npm run start.
  2. Generate an output that exceeds the terminal height in Standard Terminal mode (e.g., a long text response). Verify that the centralized "Ctrl+O" Toast hint appears.
  3. Switch to Alternate Screen Buffer (ASB) mode (e.g., using an editor like vim or setting the flag in config).
  4. Execute a command that generates a large output (e.g., a long ls or script output). Verify that the centralized "Ctrl+O" Toast hint appears.
  5. Trigger a tool confirmation prompt (e.g., executing a command that modifies the system). Ensure that the inline "Press Ctrl+O to show more lines" hint appears within the tool confirmation box instead of the global Toast hint.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@jwhelangoog jwhelangoog requested a review from a team as a code owner March 6, 2026 22:22
@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 significantly refactors the overflow hint mechanism to provide a more consistent and less intrusive user experience across different terminal buffer modes. By centralizing the 'Ctrl+O' expansion hint and intelligently managing inline hints, the system now offers a clearer way for users to interact with truncated content, especially in complex Alternate Screen Buffer environments. The changes streamline the overflow detection logic, making it more robust and easier to maintain.

Highlights

  • Unified Ctrl+O Expansion Hint: The 'Ctrl+O' expansion hint experience has been unified across both Standard Terminal and Alternate Screen Buffer (ASB) modes. The centralized hint within the ToastDisplay of the Composer now triggers for overflowing views in output history for both modes.
  • Removed Inline Hints for ASB History: All isolated inline hints (e.g., ShowMoreLines component) have been removed from ASB history output to prevent 'hint spam' and centralize the overflow notification.
  • Maintained Contextual Inline Hints: Contextual UI components, such as Tool Confirmation views, will continue to display isolated inline hints in both Standard and ASB modes where appropriate.
  • Global Overflow Reporting for ASB Scrollable Components: Opt-in global overflow reporting has been added for ASB scrollable components, ensuring that individual tool results trigger the global hint without the main history scrollback causing excessive notifications.
  • Refactored Overflow Logic: Local hasOverflow calculations, useEffect hooks, and ShowMoreLines component rendering were removed from ToolGroupMessage.tsx. Overflow reporting is now delegated to child components like ToolResultDisplay and Scrollable, which bubble events up to the global AppContainer.
Changelog
  • packages/cli/src/ui/AppContainer.test.tsx
    • Updated test description and assertion to correctly reflect that showIsExpandableHint is now set in Alternate Buffer Mode.
  • packages/cli/src/ui/AppContainer.tsx
    • Removed the isAlternateBuffer condition from the useEffect hook, allowing the expand hint to trigger universally when overflow state is present.
  • packages/cli/src/ui/components/FolderTrustDialog.tsx
    • Simplified the rendering logic by removing the conditional OverflowProvider wrapper based on isAlternateBuffer.
  • packages/cli/src/ui/components/ShowMoreLines.test.tsx
    • Updated test to assert that ShowMoreLines renders a message in Standard mode when overflowing, and adjusted the expected content.
  • packages/cli/src/ui/components/ShowMoreLines.tsx
    • Removed the useAlternateBuffer hook and the isAlternateBuffer condition, making the component always render if overflowing and constrained.
  • packages/cli/src/ui/components/ShowMoreLinesLayout.test.tsx
    • Added a new test case to verify that ShowMoreLines renders correctly in Standard mode.
  • packages/cli/src/ui/components/ToastDisplay.test.tsx
    • Updated test assertion to include 'Press' in the Ctrl+O hint text for consistency.
  • packages/cli/src/ui/components/ToastDisplay.tsx
    • Changed the Ctrl+O hint text from 'Ctrl+O' to 'Press Ctrl+O' for better clarity.
  • packages/cli/src/ui/components/ToolConfirmationQueue.tsx
    • Removed the useAlternateBuffer hook and simplified rendering by removing the conditional OverflowProvider.
  • packages/cli/src/ui/components/snapshots/MainContent.test.tsx.snap
    • Removed the inline 'Press Ctrl+O to show more lines' hint from snapshots, reflecting its removal from main content.
  • packages/cli/src/ui/components/snapshots/ToolConfirmationQueue.test.tsx.snap
    • Added the inline 'Press Ctrl+O to show more lines' hint to the snapshot, confirming its presence in tool confirmations.
  • packages/cli/src/ui/components/messages/GeminiMessage.tsx
    • Removed ShowMoreLines, useAlternateBuffer, and OverflowProvider imports and related logic, centralizing overflow handling.
  • packages/cli/src/ui/components/messages/GeminiMessageContent.tsx
    • Removed ShowMoreLines and useAlternateBuffer imports and related logic, centralizing overflow handling.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx
    • Removed the extensive 'Manual Overflow Detection' test suite and the act import, simplifying the test file.
  • packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
    • Removed ShowMoreLines, useAlternateBuffer, calculateShellMaxLines, calculateToolContentMaxLines imports and related local overflow calculation logic, and removed the ShowMoreLines component from rendering.
  • packages/cli/src/ui/components/messages/ToolOverflowConsistencyChecks.test.tsx
    • Updated test descriptions and removed the OverflowProvider wrapper, adjusting assertions to reflect the new global overflow reporting mechanism.
  • packages/cli/src/ui/components/messages/ToolResultDisplay.tsx
    • Added the reportOverflow={true} prop to the Scrollable component to enable global overflow reporting.
  • packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx
    • Removed the entire test file as its functionality is now covered by other tests and the new overflow logic.
  • packages/cli/src/ui/components/shared/Scrollable.tsx
    • Added a reportOverflow prop, useId, useOverflowActions, and useEffect hooks to report overflow status to the global OverflowContext.
Activity
  • The pull request author, jwhelangoog, has provided a detailed summary, validation steps, and a pre-merge checklist, indicating thorough preparation.
  • All checklist items for documentation, tests, and MacOS validation have been marked as complete by the author.
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.

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 successfully unifies the Ctrl+O expansion hint experience by centralizing overflow detection and display. The changes correctly delegate overflow reporting from ToolGroupMessage to child components like Scrollable, which now has an opt-in mechanism to report overflow to a global context. This simplifies the message components and provides a consistent user experience in both standard and alternate screen buffer modes. The tests have been updated accordingly, but one test file contains an incomplete test case that should be fixed to ensure full coverage of the new functionality and adhere to testing best practices, including proper cleanup when using renderWithProviders.

Note: Security Review did not run due to the size of the PR.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Size Change: -2.48 kB (-0.01%)

Total Size: 26 MB

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

compressed-size-action

@jwhelangoog jwhelangoog force-pushed the feature/consolidate-overflow-hints branch from bd4ac98 to 31c9505 Compare March 6, 2026 22:27
@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Mar 6, 2026
@jwhelangoog jwhelangoog force-pushed the feature/consolidate-overflow-hints branch 2 times, most recently from 953c09e to aea6305 Compare March 7, 2026 00:15
) : (
content
);
return <OverflowProvider>{content}</OverflowProvider>;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we be just returning content rather than always wrapping in an overflow provider?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For FolderTrustDialog.tsx and the ToolConfirmationQueue.tsx, the wrapper helps prevent any overflowing elements w/in these drawers/dialogs from triggering the global hint. At least initially, it allows just their local ShowMoreLine components to render. Without the wrappers we get something like this when they have overflow: https://screenshot.googleplex.com/37BxeV57LD29Mds.png

Copy link
Contributor

Choose a reason for hiding this comment

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

ok fine for now. please cleanup in a followup so we show the overflow hint with an appropriate message in the main area to keep this simple.


import type React from 'react';
import { useState, useRef, useCallback, useMemo, useLayoutEffect } from 'react';
import {
Copy link
Contributor

Choose a reason for hiding this comment

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

what are these changes to scrollable trying to do? this all seems wrong and error prone and can hopefully just be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

three hooks being added: useEffect, useId, and useOverflowAction to let Scrollable self-report that it has overflowing content; but only when reportOverflow is true. The flag gives the option for scrollables like the main output history to withhold 'overflow' signaling, so it doesn't trigger the global Ctrl+O hint.

) : (
content
);
return <OverflowProvider>{content}</OverflowProvider>;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this defaulting to the alternate buffer version rather than the regular version? these changes should be making alternate buffer mode more like regular mode as far as this goes not vice vesa.

Copy link
Contributor Author

@jwhelangoog jwhelangoog Mar 7, 2026

Choose a reason for hiding this comment

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

See comment

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

Approved after these comments are addressed. thanks for the cleanup! this makes the experience a lot cleaner in alternate buffer mode.

- Show Ctrl+O overflow hint in the composer toast display when overflow components exist in the output history (hint no longer appears in output history stream)
- Continue using isolated inline hints for contextual UI (such as the Tool Confirmation views)
- Opt-in global overflow reporting for ASB scrollable components
- Update AppContainer tests for asynchronous overflow reporting in ASB mode
- Update MainContent snapshots reflecting removal of inline hints
- Clean up obsolete tool result display overflow tests
@jwhelangoog jwhelangoog force-pushed the feature/consolidate-overflow-hints branch from aea6305 to 92c7bb6 Compare March 7, 2026 05:39
 - ShowMoreLine.tsx: relevant changes only
 - ToolOverflowConsistencyChecks.test: remove unncessary mock, add waitUntilReady() calls to ensure initial renders finish (avoid flakiness)
@jwhelangoog jwhelangoog force-pushed the feature/consolidate-overflow-hints branch from 7f9b6b7 to 415e9e3 Compare March 7, 2026 07:45
Copy link
Contributor Author

@jwhelangoog jwhelangoog left a comment

Choose a reason for hiding this comment

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

PTAL

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

) : (
content
);
return <OverflowProvider>{content}</OverflowProvider>;
Copy link
Contributor

Choose a reason for hiding this comment

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

ok fine for now. please cleanup in a followup so we show the overflow hint with an appropriate message in the main area to keep this simple.

@jacob314 jacob314 added this pull request to the merge queue Mar 7, 2026
Merged via the queue into main with commit 54b0344 Mar 7, 2026
27 checks passed
@jacob314 jacob314 deleted the feature/consolidate-overflow-hints branch March 7, 2026 19:18
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align "Show more lines" placement across Standard and ASB modes

2 participants