mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 14:44:29 +00:00
Refactoring of disabling of mouse tracking in e2e tests (#17902)
This commit is contained in:
@@ -13,6 +13,7 @@ import { mkdir, readdir, rm } from 'node:fs/promises';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { canUseRipgrep } from '../packages/core/src/tools/ripGrep.js';
|
||||
import { disableMouseTracking } from '@google/gemini-cli-core';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const rootDir = join(__dirname, '..');
|
||||
@@ -74,9 +75,7 @@ export async function setup() {
|
||||
export async function teardown() {
|
||||
// Disable mouse tracking
|
||||
if (process.stdout.isTTY) {
|
||||
process.stdout.write(
|
||||
'\x1b[?1000l\x1b[?1003l\x1b[?1015l\x1b[?1006l\x1b[?1002l',
|
||||
);
|
||||
disableMouseTracking();
|
||||
}
|
||||
|
||||
// Cleanup the test run directory unless KEEP_OUTPUT is set
|
||||
|
||||
@@ -6,6 +6,21 @@
|
||||
|
||||
import { writeToStdout } from './stdio.js';
|
||||
|
||||
/**
|
||||
* ANSI escape codes for disabling mouse tracking.
|
||||
*/
|
||||
export function disableMouseTracking() {
|
||||
writeToStdout(
|
||||
[
|
||||
'\x1b[?1000l', // Normal tracking
|
||||
'\x1b[?1003l', // Any-event tracking
|
||||
'\x1b[?1015l', // urxvt extended mouse mode
|
||||
'\x1b[?1006l', // SGR-style mouse tracking
|
||||
'\x1b[?1002l', // Button-event tracking
|
||||
].join(''),
|
||||
);
|
||||
}
|
||||
|
||||
export function enableMouseEvents() {
|
||||
// Enable mouse tracking with SGR format
|
||||
// ?1002h = button event tracking (clicks + drags + scroll wheel)
|
||||
|
||||
Reference in New Issue
Block a user