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 refactors the terminal protocol detection and enabling logic by switching from 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 correctly replaces asynchronous process.stdout.write calls with synchronous fs.writeSync calls. This is an important improvement, particularly for the disableAllProtocols function which is registered as an exit handler, as only synchronous operations are guaranteed to complete before a process exits. My review includes suggestions to improve the readability and maintainability of the new code by avoiding the use of a magic number for the stdout file descriptor.
|
Size Change: +146 B (0%) Total Size: 21.1 MB ℹ️ View Unchanged
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request changes terminal writes from asynchronous process.stdout.write to synchronous fs.writeSync to prevent potential race conditions when detecting keyboard protocol support. This is a good approach to ensure control sequences are sent before the application attempts to read a response. My review includes suggestions to improve the robustness of error handling in disableAllProtocols and enableSupportedProtocol, where a single try...catch block could leave the terminal in an inconsistent state if one of the write operations fails.
| process.stdout.write('\x1b[?1006l'); // Disable SGR Mouse | ||
| sgrMouseEnabled = false; | ||
| try { | ||
| if (kittyEnabled) { |
There was a problem hiding this comment.
add a comment why we use the nonstandard writeSync which would generally be against project guidelines if it wasn't for the reasons mentioned in the pr description. You could even just mention the bug this is believed to fix.

Summary
Use synchronous writes when detecting/enabling/disabling keyboard modes
Details
There's a slight chance this will fix the "9;5u" problem.