fix(patch): cherry-pick 030a5ac to release/v0.18.3-pr-13565 [CONFLICTS] (#13869)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
gemini-cli-robot
2025-11-26 13:22:14 -08:00
committed by GitHub
parent 3f4d5c07b3
commit 2e8d7831c6
17 changed files with 355 additions and 190 deletions
@@ -97,6 +97,11 @@ export async function detectAndEnableKittyProtocol(): Promise<void> {
});
}
import {
enableKittyKeyboardProtocol,
disableKittyKeyboardProtocol,
} from '@google/gemini-cli-core';
export function isKittyProtocolEnabled(): boolean {
return kittyEnabled;
}
@@ -104,8 +109,7 @@ export function isKittyProtocolEnabled(): boolean {
function disableAllProtocols() {
try {
if (kittyEnabled) {
// use writeSync to avoid race conditions
fs.writeSync(process.stdout.fd, '\x1b[<u');
disableKittyKeyboardProtocol();
kittyEnabled = false;
}
} catch {
@@ -120,8 +124,7 @@ function disableAllProtocols() {
export function enableSupportedProtocol(): void {
try {
if (kittySupported) {
// use writeSync to avoid race conditions
fs.writeSync(process.stdout.fd, '\x1b[>1u');
enableKittyKeyboardProtocol();
kittyEnabled = true;
}
} catch {
+2 -12
View File
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { writeToStdout } from '../../utils/stdio.js';
import { enableMouseEvents, disableMouseEvents } from '@google/gemini-cli-core';
import {
SGR_MOUSE_REGEX,
X11_MOUSE_REGEX,
@@ -230,14 +230,4 @@ export function isIncompleteMouseSequence(buffer: string): boolean {
return true;
}
export function enableMouseEvents() {
// Enable mouse tracking with SGR format
// ?1002h = button event tracking (clicks + drags + scroll wheel)
// ?1006h = SGR extended mouse mode (better coordinate handling)
writeToStdout('\u001b[?1002h\u001b[?1006h');
}
export function disableMouseEvents() {
// Disable mouse tracking with SGR format
writeToStdout('\u001b[?1006l\u001b[?1002l');
}
export { enableMouseEvents, disableMouseEvents };