Restore bracketed paste mode after external editor exit#13606
Conversation
Summary of ChangesHello @scidomino, 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 addresses a bug where terminal modes, specifically bracketed paste, mouse events, and the kitty protocol, were not reliably re-enabled after returning from an external editor. The changes centralize the management of these terminal modes into new utility functions, ensuring their correct restoration and preventing potential issues like unsafe paste warnings. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request refactors terminal mode handling and fixes an issue where bracketed paste mode was not restored after an external editor exits. The refactoring is a good improvement, centralizing terminal mode management. However, I've identified a potential issue where mouse events are now unconditionally re-enabled, which could cause problems for users not running in alternate screen mode. My review includes suggestions to make mouse event restoration conditional, similar to the previous behavior, while still applying the bracketed paste mode fix unconditionally.
|
Size Change: +255 B (0%) Total Size: 21.1 MB ℹ️ View Unchanged
|
b18c38e to
f266e15
Compare
This ensures that bracketed paste mode (along with mouse and kitty protocol) is correctly re-enabled after returning from an external editor like vim or nano, preventing unsafe paste warnings in terminals like Ghostty.
f266e15 to
ef56535
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where bracketed paste mode was not being restored after an external editor exits. The changes are well-structured, introducing a new utility for managing bracketed paste mode, which is a good refactoring that improves maintainability. The fix itself, which involves re-enabling bracketed paste mode in the handleEditorClose callback, is correctly implemented and placed alongside other terminal state restoration logic. The related test mocks have also been updated appropriately. Overall, the changes are solid and I have no concerns.

Summary
Restore bracketed paste mode after external editor exit
Details
Also fixed
gemini.test.tsxbug that left the keyboard in a bad state after running.Related Issues
Fixes #12920
How to Validate
Enter and exit edit mode with
ctrl+x.Pre-Merge Checklist