Skip to content

Code review comments as a pr#21209

Merged
jacob314 merged 3 commits intomainfrom
status_line_review
Mar 8, 2026
Merged

Code review comments as a pr#21209
jacob314 merged 3 commits intomainfrom
status_line_review

Conversation

@jacob314
Copy link
Copy Markdown
Contributor

@jacob314 jacob314 commented Mar 5, 2026

Summary

Code review comments as a pr.
Fixes #21208

Updated footer dialog aligned with other recent style changes:
image

Questionable UI left. The single line footer version puts the dots in slightly odd places. Not sure exactly how we'd want to render this.

image

@jacob314 jacob314 requested a review from a team as a code owner March 5, 2026 04:08
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Mar 5, 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
Copy Markdown
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 focuses on enhancing the user experience of the application's footer. It addresses issues with how footer items are displayed, particularly in constrained terminal environments, by implementing a more sophisticated truncation algorithm. Additionally, the footer configuration dialog has undergone a substantial refactor, making it more intuitive and flexible for users to customize their footer layout and visibility preferences.

Highlights

  • Improved Footer Truncation Logic: The footer component now intelligently handles item truncation, ensuring high-priority items like the Vim mode indicator ('[INSERT]') remain fully visible even on narrow terminals. This was achieved by refining the width fitting calculations and introducing flexGrow and flexShrink properties for footer items.
  • Refactored Footer Configuration Dialog: The FooterConfigDialog has been significantly refactored to utilize a new BaseSelectionList component. This change simplifies the dialog's internal state management, improves navigation (including item reordering), and enhances responsiveness to terminal height changes.
  • Enhanced UI Testing with SVG Snapshots: New SVG snapshot tests have been added for the FooterConfigDialog to visually capture and track UI changes, providing more robust regression protection for the component's rendering.
  • Footer Item Reordering: Users can now reorder footer items within the configuration dialog using the left and right arrow keys, providing greater customization over the footer's layout.
Changelog
  • packages/cli/src/ui/components/Footer.test.tsx
    • Updated path truncation assertions to be more concise.
    • Added a new test case to verify high-priority footer items are not truncated on narrow terminals.
  • packages/cli/src/ui/components/Footer.tsx
    • Extended FooterRowItem interface with flexGrow, flexShrink, and isFocused properties.
    • Applied new flexbox properties and focus-based styling to FooterRow items.
    • Ensured FooterRow occupies 100% of available width.
    • Rewrote width fitting logic in the Footer component to prevent over-estimation truncation, especially for the workspace item.
    • Configured flexGrow and flexShrink for workspace and ellipsis footer items.
  • packages/cli/src/ui/components/FooterConfigDialog.test.tsx
    • Updated test utility usage for renderWithProviders to improve consistency.
    • Added SVG snapshot tests for the dialog's rendering.
    • Corrected item ID references from 'git-branch' to 'branch' in tests.
    • Modified the 'highlights the active item in the preview' test to focus on the 'diff' item and verify its toggle and preview behavior.
    • Adjusted the 'shows an empty preview' test to correctly deselect default items and verify the empty preview state.
  • packages/cli/src/ui/components/FooterConfigDialog.tsx
    • Refactored FooterConfigDialog to use useState and useUIState hooks.
    • Simplified FooterConfigState by removing activeIndex and scrollOffset.
    • Updated footerConfigReducer to handle item movement and toggling more directly, removing complex index management.
    • Integrated BaseSelectionList component for rendering and managing the list of configurable footer items.
    • Introduced focusKey state to track the currently highlighted item.
    • Refactored listItems generation to include 'show-labels' and 'reset' as distinct configurable types.
    • Updated handleResetToDefaults to reset the focusKey.
    • Modified useKeypress to delegate list navigation to BaseSelectionList and handle item reordering.
    • Adjusted preview content logic to use focusKey for determining active item display.
    • Implemented dynamic padding calculation for the dialog based on terminal height.
    • Replaced manual navigation instructions with the DialogFooter component.
    • Ensured the preview Box takes full width.
  • packages/cli/src/ui/components/snapshots/Footer.test.tsx.snap
    • Updated snapshots to reflect changes in footer item width and layout.
  • packages/cli/src/ui/components/snapshots/FooterConfigDialog--FooterConfigDialog-highlights-the-active-item-in-the-preview.snap.svg
    • Added new SVG snapshot for the footer configuration dialog when an item is highlighted.
  • packages/cli/src/ui/components/snapshots/FooterConfigDialog--FooterConfigDialog-renders-correctly-with-default-settings.snap.svg
    • Added new SVG snapshot for the footer configuration dialog with default settings.
  • packages/cli/src/ui/components/snapshots/FooterConfigDialog.test.tsx.snap
    • Updated snapshots due to refactoring of the footer configuration dialog and new test cases.
  • packages/cli/src/ui/components/shared/BaseSelectionList.tsx
    • Added selectedIndicator prop to BaseSelectionListProps to allow custom selection markers.
    • Updated the rendering of the active item to use the new selectedIndicator prop.
Activity
  • The author, jacob314, initiated this pull request, titled 'Code review comments as a pr', indicating it addresses feedback from previous reviews.
  • The changes primarily involve refactoring UI components and improving rendering logic, suggesting a focus on code quality and user experience based on iterative feedback.
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
Copy Markdown
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 introduces a significant and welcome refactoring of the footer and its configuration dialog. The footer's layout logic has been improved to use flexbox, fixing a regression where high-priority items could be truncated on narrow terminals. The footer configuration dialog has been completely rewritten to use a reusable BaseSelectionList component, which greatly improves its structure, maintainability, and responsiveness to terminal height. The tests have also been updated and expanded with SVG snapshots, increasing confidence in the UI changes.

I have one piece of feedback regarding a potentially incorrect magic number used for layout calculations in the FooterConfigDialog.

: Number.MAX_SAFE_INTEGER;

const BORDER_HEIGHT = 2; // Outer round border
const STATIC_ELEMENTS = 13; // Text, margins, preview box, dialog footer
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The value 13 for STATIC_ELEMENTS is a magic number used for layout calculation. As per repository guidelines, magic numbers, especially those for layout or padding, should be replaced with named constants to improve readability and maintainability. This makes the intent clearer and simplifies future updates.

Furthermore, a manual count of the static lines in the component's layout suggests the value should be 12.

Here's a breakdown of the static lines:

  • Title (<Text bold> with \n): 2 lines
  • Subtitle (<Text color...>): 1 line
  • List marginTop: 1 line
  • DialogFooter (marginTop + text): 2 lines
  • Preview marginTop: 1 line
  • Preview borderStyle: 2 lines
  • Preview title (<Text bold>): 1 line
  • Preview content (FooterRow): 2 lines

Total: 2 + 1 + 1 + 2 + 1 + 2 + 1 + 2 = 12 lines.

Using an incorrect value can lead to miscalculation of the available space for the list, potentially causing rendering issues on terminals with limited height. While the current value 13 is safer (allocating less space than available), it's still a bug and a maintainability concern.

Please define STATIC_ELEMENTS as a named constant with the correct value (12), or provide a detailed explanation if 13 is indeed correct and my calculation is missing something.

References
  1. Magic numbers, especially those used for layout or padding, should be replaced with named constants to improve readability and maintainability. This makes the intent clearer and simplifies future updates.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

Size Change: -724 B (0%)

Total Size: 26 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.5 MB -724 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 5, 2026
Copy link
Copy Markdown
Contributor Author

@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.

I've reviewed the PR and found two minor issues:

1. The "Odd Places" for Dots Issue (Footer.tsx)

In Footer.tsx, you map columns to rowItems and apply:

flexGrow: isWorkspace ? 1 : 0,
flexShrink: isWorkspace ? 1 : 0,

However, the CwdIndicator uses shortenPath() to manually truncate the text to the estimatedWidth. This means the <Text> inside the workspace column is already the correct, constrained length.

Because the wrapping <Box> has flexGrow: 1, it expands to fill any remaining horizontal space in the terminal. When showLabels is false, Ink renders the workspace text, then leaves a large gap of empty space inside that Box before moving on to the dot separator (which is rendered in the next sibling Box). This causes the dot to float far to the right, right next to the next item. Additionally, if the workspace is focused, the theme.background.focus will awkwardly stretch across that empty gap.
Recommendation: Change flexGrow to 0 for the workspace item. The Box will then fit the text tightly, and the dot separators will render directly adjacent to it as expected.

2. useKeypress Re-subscriptions (FooterConfigDialog.tsx)

The useKeypress hook is passed an inline arrow function:

useKeypress(
  (key: Key) => {
    // ... uses focusKey, orderedIds, dispatch ...
  },
  { isActive: true, priority: true }
);

Since this inline function is re-created on every render, and useKeypress uses this handler in its useEffect dependency array, it will unsubscribe and re-subscribe to stdin events on every single render.
Recommendation: Wrap the handler in a useCallback with the appropriate dependencies (focusKey, orderedIds, dispatch) to avoid unnecessary re-subscriptions to stdin events.

@jacob314
Copy link
Copy Markdown
Contributor Author

jacob314 commented Mar 5, 2026

Review completed. Two comments added regarding flex properties and useKeypress hook.

Copy link
Copy Markdown
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

UX team had agreed on left to right footer items... why are we changing that here?

Also from your image it looks like we are now using headers as the list items instead of item ids...

It doesn't make sense to use headers because /stats is not a good representation in the dialog, it should remain usage in my opinion.

Also now each item is taking up two lines header and description underneath instead of previously each taking 1 with description on same line. Was this intentional to keep things more narrow but long?

Is this dialog now going to get truncated and require expansion with Ctrl+O?

@jacob314
Copy link
Copy Markdown
Contributor Author

jacob314 commented Mar 7, 2026

image

Thanks for the review! Fixed the regression in the titles shown in the footer dialog.
Fixed a general bug in useSelectionList this uncovered that was causing the selection to not get updated when it should.

Left the items as 2 lines. Offline discussion: a single line doesn't meet the 80 char limit. We can make useSelectionList generically support a mode where summary and details are split across multiple lines if we want but should be a follow up pr.

@jacob314 jacob314 force-pushed the status_line_review branch 2 times, most recently from d26c0fa to 55c48b2 Compare March 7, 2026 20:14
@jacob314 jacob314 enabled auto-merge March 8, 2026 00:14
@jacob314 jacob314 force-pushed the status_line_review branch from 55c48b2 to c88a162 Compare March 8, 2026 00:54
Copy link
Copy Markdown

@GlatnahHapa GlatnahHapa left a comment

Choose a reason for hiding this comment

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

Update

@GlatnahHapa
Copy link
Copy Markdown

Update

@jacob314 jacob314 added this pull request to the merge queue Mar 8, 2026
Merged via the queue into main with commit d012929 Mar 8, 2026
27 checks passed
@jacob314 jacob314 deleted the status_line_review branch March 8, 2026 08:51
TravisHaa pushed a commit to TravisHaa/gemini-cli that referenced this pull request Mar 8, 2026
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
SUNDRAM07 pushed a commit to SUNDRAM07/gemini-cli that referenced this pull request Mar 30, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status line review polish

3 participants