Skip to content

Conversation

@jackwotherspoon
Copy link
Contributor

@jackwotherspoon jackwotherspoon commented Jan 25, 2026

Summary

  • Add ability to double-click on [Pasted Text: X lines] placeholders to expand and view the full content inline when in alternate buffer mode
  • Double-clicking expanded content collapses it back to the placeholder
  • Editing within expanded content "detaches" it, converting to regular text that can no longer be collapsed
  • External editor shows expanded paste content instead of placeholders after using Ctrl+X
paste.transform.mp4

Details

When users paste large text blocks, the content is collapsed into a placeholder to keep the input manageable. However, users may want to review what they pasted before submitting. This provides a quick way to inspect pasted content without modifying the underlying data.

Changes

  • New useMouseDoubleClick hook for double-click detection
  • TextBufferState extended with expandedPasteInfo to track expanded regions
  • toggle_paste_expansion action for expand/collapse logic
  • detachExpandedPaste automatically converts expanded content to regular text on edit

Related Issues

How to Validate

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

@jackwotherspoon jackwotherspoon requested review from a team as code owners January 25, 2026 02:20
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jackwotherspoon, 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 enhances the user experience for handling large pasted text blocks within the CLI. By introducing an intuitive double-click mechanism, users can now seamlessly expand and collapse paste placeholders to review content without modifying the underlying data. This change improves the manageability of large inputs and ensures that the full content is accessible and consistent, whether viewed inline or in an external editor.

Highlights

  • Interactive Paste Expansion: Users can now double-click on [Pasted Text: X lines] placeholders in alternate buffer mode to expand and view the full content inline. Double-clicking again collapses it back to the placeholder.
  • Automatic Detachment on Edit: Editing within expanded content automatically 'detaches' it, converting it to regular text that can no longer be collapsed, ensuring a clear transition from temporary view to editable content.
  • External Editor Integration: When content is sent to an external editor (via Ctrl+X), any paste placeholders are automatically expanded, so the user sees the full content, not just the placeholders.
  • New useMouseDoubleClick Hook: A new React hook, useMouseDoubleClick, has been introduced to reliably detect double-click events within a specified DOM element, considering time and distance thresholds.
  • Text Buffer State Management: The TextBufferState has been extended with expandedPasteInfo to track the state of expanded paste regions. A new toggle_paste_expansion action handles the core logic for expanding and collapsing content.
  • Undo/Redo Behavior: The expansion state of pasted content is treated as a view state, not a document state, and is cleared on undo/redo operations to prevent inconsistencies.
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 introduces a great new feature allowing users to expand and collapse large pasted text placeholders with a double-click. The implementation is well-structured, introducing a reusable useMouseDoubleClick hook and cleanly integrating the expansion logic into the text-buffer state management. The addition of tests for the new functionality is also appreciated. I've found one potential issue regarding the expansion of placeholders when opening in an external editor that could lead to unexpected behavior, which is detailed in the comment. Overall, this is a solid contribution that improves the user experience when dealing with large pastes.

@github-actions
Copy link

github-actions bot commented Jan 25, 2026

Size Change: +13.5 kB (+0.06%)

Total Size: 23.4 MB

Filename Size Change
./bundle/gemini.js 23.4 MB +13.5 kB (+0.06%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

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

I've reviewed the PR and performed a local refactor to deduplicate the mouse interaction logic.

Refactor Summary

  • Enhanced useMouseClick: I've updated the useMouseClick hook to support a custom event name via its options. This allows it to be used for any mouse event, including the synthesized double-click.
  • Deduplicated InputPrompt.tsx: I've replaced the manual double-click detection and coordinate translation logic in InputPrompt with the enhanced useMouseClick hook. This eliminates redundant code and ensures consistency with how single clicks are handled.
  • Removed Redundancy: Since MouseContext.tsx already synthesizes double-click events and we now have a shared hook, the separate useMouseDoubleClick.ts hook and its tests are no longer needed.

Observations

  • External Editor: The addition of expansion logic in openInExternalEditor is excellent, ensuring users see full content when editing.
  • Buffer Logic: The shiftExpandedRegions and detachExpandedPaste implementations in text-buffer.ts are robust and follow project conventions.
  • Accidental Files: Please ensure packages/cli/debug.log is removed from the PR as it contains development error logs.

I will push these refactors to the PR branch shortly.

@gemini-cli
Copy link
Contributor

gemini-cli bot commented Jan 27, 2026

Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request.

To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues.

If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding!

@gemini-cli gemini-cli bot closed this Jan 27, 2026
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.

There a couple issues but it is easier to approve and send a follow up PR so approving to land and then follow up.

@jacob314 jacob314 reopened this Jan 27, 2026
@jacob314 jacob314 enabled auto-merge January 27, 2026 02:50
@jacob314 jacob314 added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit a79051d Jan 27, 2026
47 checks passed
@jacob314 jacob314 deleted the large-paste-transform branch January 27, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants