fix(ui): Add mouse interaction toggle to restore native text selection
Fixes #13057 #13074
🐛 The Problem
v0.15.0 broke native terminal text selection and copy/paste for 17+ users by unconditionally enabling mouse event capture when alternate buffer mode is active.
User Impact:
- Cannot select text with mouse (click+drag does nothing)
- Copy/paste broken (right-click menus don't work)
- Only workaround: Shift+drag (non-standard) or rollback to v0.14.0
🔍 Root Cause
In gemini.tsx (line 185), mouse events are unconditionally enabled when alternate buffer is true:
const mouseEventsEnabled = useAlternateBuffer; // <-- Problem!
if (mouseEventsEnabled) {
enableMouseEvents(); // Captures ALL mouse events
}
When mouse events are enabled, the terminal forwards mouse interactions to the app instead of handling them natively. This breaks standard terminal clipboard workflows.
✅ The Solution
Add a new setting ui.enableMouseInteraction that decouples mouse support from alternate buffer mode:
New Setting
-
Name:
enableMouseInteraction -
Default:
false(preserves native terminal behavior) -
Location:
/settings→ UI section - Requires Restart: Yes
Updated Logic
const mouseEventsEnabled =
useAlternateBuffer && (settings.merged.ui?.enableMouseInteraction === true);
Now users can:
- ✅ Use alternate buffer WITHOUT mouse capture (default): Native text selection works
- ✅ Opt-in to mouse interaction: Explicitly enable for mouse scrolling/clicking
📊 Benefits
- ✅ Restores native text selection and copy/paste by default
- ✅ Backwards compatible (no breaking changes)
- ✅ Gives users explicit control
- ✅ Fixes both #13057 (12👍) and #13074 (5👍) with one change
- ✅ Zero impact on users without alternate buffer
🔬 Testing
- ✅
npm run buildpasses - ✅ All existing tests pass
- ✅ When
enableMouseInteraction = false(default), native selection works - ✅ When
useAlternateBuffer = false, no behavior change
*Ready to mergeecho BEGIN___COMMAND_OUTPUT_MARKER ; PS1= ; PS2= ; unset HISTFILE ; EC=0 ; echo ___BEGIN___COMMAND_DONE_MARKER___0 ; } 🎉
Summary of Changes
Hello @JuanCS-Dev, I'm Gemini Code Assist[^1]! 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 addresses a critical usability regression where native terminal text selection and copy/paste were impaired when the alternate buffer was active. By introducing a new ui.enableMouseInteraction setting, the change provides users with explicit control over mouse event capture, thereby restoring the default native terminal text selection behavior while still offering an opt-in for application-level mouse interaction. This ensures a more intuitive and functional user experience.
Highlights
- Problem Addressed: This pull request resolves a regression introduced in v0.15.0 that broke native terminal text selection and copy/paste functionality for users when the alternate buffer mode was active. This was due to mouse events being unconditionally captured by the application.
-
New Configuration Setting: A new boolean setting,
ui.enableMouseInteraction, has been added to the UI section of the settings. It defaults tofalseand requires a restart to take effect. This setting decouples mouse event capture from the alternate buffer mode. -
Updated Mouse Event Logic: The logic in
gemini.tsxfor enabling mouse events has been updated. Mouse events are now only enabled if both the alternate buffer is active AND the newui.enableMouseInteractionsetting is explicitly set totrue. This ensures native text selection works by default. - User Control and Benefits: Users now have explicit control over mouse interaction, allowing them to use the alternate buffer without mouse capture (preserving native text selection) or opt-in to mouse interaction if desired. This change restores expected behavior, is backwards compatible, and fixes issues #13057 and #13074.
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 :thumbsup: and :thumbsdown: 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.
[^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.
When in alternate buffer bode without enabling mouse interaction, how should users scrollup and down in the conversation?