Skip to content

Code review fixes for show question mark pr.#18468

Closed
jacob314 wants to merge 1 commit intomainfrom
shortcuts_review
Closed

Code review fixes for show question mark pr.#18468
jacob314 wants to merge 1 commit intomainfrom
shortcuts_review

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Feb 6, 2026

Summary

This is cleanup for
#18035

Fixes #18479

@jacob314 jacob314 requested a review from a team as a code owner February 6, 2026 20:28
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jacob314, 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 refining the user interface experience by improving the display and interaction of shortcut hints and other UI elements. It ensures that contextual information is presented cleanly and efficiently, especially during user input, and modernizes the underlying rendering logic for key UI components to enhance responsiveness and maintainability.

Highlights

  • Improved UI Responsiveness and Logic: The ShortcutsHelp component has been refactored to better handle different terminal widths, and its visibility is now dynamically controlled based on pending user actions (like an open dialog) or paste events.
  • Enhanced Paste Handling: The system now automatically closes the shortcuts help display when any paste action (terminal paste, Ctrl+V, or mouse right-click paste) is detected, preventing UI clutter during input.
  • Refactored UI Components: HorizontalLine and SectionHeader components have been simplified and improved using Ink's Box component for better rendering and responsiveness, removing manual string manipulation for borders and truncation.
  • Comprehensive Testing: New and updated tests have been added for Composer, InputPrompt, ShortcutsHelp, and SectionHeader to ensure the correct behavior and rendering of these UI components, including snapshot tests for visual consistency.
Changelog
  • packages/cli/src/ui/components/Composer.test.tsx
    • Added tests to verify that the ShortcutsHint component is hidden when a custom dialog is active and visible when no action is required.
  • packages/cli/src/ui/components/Composer.tsx
    • Implemented conditional rendering for ShortcutsHint to hide it when a pending action is required.
    • Removed the explicit width prop from HorizontalLine usage.
  • packages/cli/src/ui/components/InputPrompt.test.tsx
    • Added tests to confirm that the shortcuts help display closes automatically upon various paste events (terminal paste, Ctrl+V, mouse right-click paste).
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Modified paste handling logic to automatically dismiss the shortcuts help display if it is visible during a paste operation.
    • Updated dependencies for handleClipboardPaste useCallback.
  • packages/cli/src/ui/components/ShortcutsHelp.test.tsx
    • New test file added to include snapshot tests for the ShortcutsHelp component in both wide and narrow terminal configurations.
  • packages/cli/src/ui/components/ShortcutsHelp.tsx
    • Refactored the ShortcutsHelp component to use a more flexible Box layout with flexWrap for better responsiveness across different terminal widths.
    • Simplified the shortcut item rendering logic by removing manual string width calculations and text wrapping utilities.
    • Updated to use useUIState for terminal width instead of useTerminalSize.
  • packages/cli/src/ui/components/snapshots/ShortcutsHelp.test.tsx.snap
    • Added snapshot data for the ShortcutsHelp component tests.
  • packages/cli/src/ui/components/shared/HorizontalLine.tsx
    • Reimplemented HorizontalLine using Ink's Box component with borderStyle for a more robust and consistent horizontal line rendering.
    • Removed the width prop, allowing the component to automatically span 100% of its parent's width.
  • packages/cli/src/ui/components/shared/SectionHeader.test.tsx
    • New test file added to include snapshot tests for the SectionHeader component, covering standard, truncated, and narrow rendering scenarios.
  • packages/cli/src/ui/components/shared/SectionHeader.tsx
    • Refactored the SectionHeader component to leverage Ink's Box and Text components for improved title truncation and dynamic line rendering.
    • Simplified the internal logic by removing manual string manipulation for header lines.
  • packages/cli/src/ui/components/shared/snapshots/SectionHeader.test.tsx.snap
    • Added snapshot data for the SectionHeader component tests.
Activity
  • The pull request title indicates that these changes are code review fixes for a previous pull request related to showing a question mark. No explicit activity (comments, reviews, etc.) is detailed in the provided description.
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.

@google-gemini google-gemini deleted a comment from gemini-cli bot Feb 6, 2026
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 6, 2026

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding Fixes #123 or Related to #123), it will be automatically reopened.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details on supported keywords and how linking works, please refer to the GitHub Documentation on linking pull requests to issues.

Thank you for your understanding and for being a part of our community!

@gemini-cli gemini-cli bot closed this Feb 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 introduces a new feature to hide the shortcuts hint and help panel during paste actions or when other UI elements require user action, enhancing the user experience. A security audit confirmed no high or critical severity vulnerabilities, specifically noting a security improvement in InputPrompt.tsx to prevent accidental command execution when pasting text into the terminal, and secure handling of spawnAsync, powershell, and osascript calls in clipboardUtils.ts against command injection. Furthermore, the PR includes significant refactoring of the ShortcutsHelp, HorizontalLine, and SectionHeader components, replacing complex manual layout with modern, declarative Ink components using flexbox. This refactoring simplifies the code, improves maintainability, and makes the layout more robust, with changes thoroughly tested by new unit tests and snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't perform unneeded text measurement in ShortcutsHelp

1 participant