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 enhances the application's paste functionality by introducing a robust fallback mechanism. Previously, if the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
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 enhances the application's paste functionality by introducing a robust fallback mechanism. Previously, if the primary method for reading clipboard content failed, the paste operation would simply error out. Now, the system attempts to retrieve the clipboard content using an OSC 52 query to the terminal, ensuring a more reliable paste experience. This change involves both requesting the OSC 52 data and processing its response, along with updated error messaging and comprehensive test coverage. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
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 significantly improves the robustness of paste functionality within the application. By introducing a fallback mechanism that leverages the OSC 52 terminal protocol, the system can now retrieve clipboard content even when the standard Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
|
Size Change: +1.58 kB (+0.01%) Total Size: 22.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a fallback mechanism for clipboard pasting using the OSC 52 protocol, which is a valuable enhancement for terminal compatibility. The changes are well-implemented, with new logic for parsing OSC 52 responses and comprehensive tests to validate it. I've identified one high-severity issue concerning the handling of large paste payloads, which could lead to excessive memory usage and application instability. My review includes a detailed comment and a code suggestion to address this potential denial-of-service vulnerability.
There was a problem hiding this comment.
Code Review
This pull request introduces a fallback mechanism for pasting text using the OSC 52 escape sequence, which is triggered when the primary clipboardy library fails. The implementation is robust, correctly handling the request for clipboard content and parsing the terminal's response. The parsing logic in KeypressContext.tsx is well-designed, covering various scenarios such as different terminators (BEL and ST), split data chunks, and invalid sequences. The accompanying tests are comprehensive and validate the new functionality thoroughly. Overall, this is a high-quality contribution that improves the tool's resilience in different terminal environments.
jacob314
left a comment
There was a problem hiding this comment.
What do you think of querying XTGETTCAP
to test whether the terminal supports OSC 52 paste. If it does I think it should be our primary option not a fallback option. The same place we detect the terminal background color and whether kitty is supported would be ideal for this.
From Gemini:
Modern terminals (Kitty, WezTerm, recent xterm) support a query sequence called XTGETTCAP. You can ask the terminal specifically for the Ms (Manipulate Selection) capability.
How it works:
Send \x1bP+q546e\x1b\ (Request capability "Tn" - often mapped to clipboard).
Or specifically query the termcap code for clipboard Ms.
Listen to stdin for a response.
|
I don't think it would be a good default since all the terminals I've tried that support this pop up an ugly warning dialog each time a paste is processed. That would be a big downgrade for existing users. Detecting support would only be useful for preventing dumping garbage characters to the screens of terminals that don't support it. But that doesn't seem super important to me. Paste will be broken there anyways. |
ca00d36 to
f5bdea1
Compare
|
We should use OSC 52 for copy as well as paste. In fact that is the use of OSC 52 that we should potentially use by default rather than requiring a setting as terminals do not block it as copying to the clipboard is safer than reading from it. This will be important for people using SSH. |

Summary
Add setting to support OSC 52 paste
Details
Some users can't paste any other way. it's off by default.
How to Validate
Add to your settings.json:
Use alternate buffer mode and paste with a mouse right-click and verify that it works (it may pop up a warning dialog first). (Note: depending on your terminal, ctrl+v may still use bracketed paste and not OSC 52)
Pre-Merge Checklist