mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-20 15:00:54 -07:00
fix(cli): update JetBrains terminal warning messaging and only show in alternate buffer mode
This commit is contained in:
@@ -20,7 +20,8 @@ async function run(cmd) {
|
|||||||
stdio: ['pipe', 'pipe', 'ignore'],
|
stdio: ['pipe', 'pipe', 'ignore'],
|
||||||
});
|
});
|
||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
} catch (_e) { // eslint-disable-line @typescript-eslint/no-unused-vars
|
} catch (_e) {
|
||||||
|
// eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,11 @@ export async function getUserStartupWarnings(
|
|||||||
const warnings = results.filter((w): w is StartupWarning => w !== null);
|
const warnings = results.filter((w): w is StartupWarning => w !== null);
|
||||||
|
|
||||||
if (settings.ui?.showCompatibilityWarnings !== false) {
|
if (settings.ui?.showCompatibilityWarnings !== false) {
|
||||||
warnings.push(...getCompatibilityWarnings());
|
warnings.push(
|
||||||
|
...getCompatibilityWarnings({
|
||||||
|
useAlternateBuffer: settings.ui?.useAlternateBuffer !== false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return warnings;
|
return warnings;
|
||||||
|
|||||||
@@ -131,11 +131,11 @@ describe('compatibility', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return JetBrains warning when detected', () => {
|
it('should return JetBrains warning when detected and useAlternateBuffer is true', () => {
|
||||||
vi.mocked(os.platform).mockReturnValue('darwin');
|
vi.mocked(os.platform).mockReturnValue('darwin');
|
||||||
vi.stubEnv('TERMINAL_EMULATOR', 'JetBrains-JediTerm');
|
vi.stubEnv('TERMINAL_EMULATOR', 'JetBrains-JediTerm');
|
||||||
|
|
||||||
const warnings = getCompatibilityWarnings();
|
const warnings = getCompatibilityWarnings({ useAlternateBuffer: true });
|
||||||
expect(warnings).toContainEqual(
|
expect(warnings).toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: 'jetbrains-terminal',
|
id: 'jetbrains-terminal',
|
||||||
@@ -144,6 +144,16 @@ describe('compatibility', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should NOT return JetBrains warning when detected but useAlternateBuffer is false', () => {
|
||||||
|
vi.mocked(os.platform).mockReturnValue('darwin');
|
||||||
|
vi.stubEnv('TERMINAL_EMULATOR', 'JetBrains-JediTerm');
|
||||||
|
|
||||||
|
const warnings = getCompatibilityWarnings({ useAlternateBuffer: false });
|
||||||
|
expect(
|
||||||
|
warnings.find((w) => w.id === 'jetbrains-terminal'),
|
||||||
|
).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
it('should return 256-color warning when 256 colors are not supported', () => {
|
it('should return 256-color warning when 256 colors are not supported', () => {
|
||||||
vi.mocked(os.platform).mockReturnValue('linux');
|
vi.mocked(os.platform).mockReturnValue('linux');
|
||||||
vi.stubEnv('TERMINAL_EMULATOR', '');
|
vi.stubEnv('TERMINAL_EMULATOR', '');
|
||||||
@@ -201,7 +211,7 @@ describe('compatibility', () => {
|
|||||||
vi.stubEnv('TERM_PROGRAM', 'xterm');
|
vi.stubEnv('TERM_PROGRAM', 'xterm');
|
||||||
process.stdout.getColorDepth = vi.fn().mockReturnValue(8);
|
process.stdout.getColorDepth = vi.fn().mockReturnValue(8);
|
||||||
|
|
||||||
const warnings = getCompatibilityWarnings();
|
const warnings = getCompatibilityWarnings({ useAlternateBuffer: true });
|
||||||
expect(warnings).toHaveLength(3);
|
expect(warnings).toHaveLength(3);
|
||||||
expect(warnings[0].message).toContain('Windows 10 detected');
|
expect(warnings[0].message).toContain('Windows 10 detected');
|
||||||
expect(warnings[1].message).toContain('JetBrains terminal detected');
|
expect(warnings[1].message).toContain('JetBrains terminal detected');
|
||||||
|
|||||||
@@ -89,7 +89,13 @@ export interface StartupWarning {
|
|||||||
priority: WarningPriority;
|
priority: WarningPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCompatibilityWarnings(): StartupWarning[] {
|
export interface CompatibilityOptions {
|
||||||
|
useAlternateBuffer?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCompatibilityWarnings(
|
||||||
|
options: CompatibilityOptions = {},
|
||||||
|
): StartupWarning[] {
|
||||||
const warnings: StartupWarning[] = [];
|
const warnings: StartupWarning[] = [];
|
||||||
|
|
||||||
if (isWindows10()) {
|
if (isWindows10()) {
|
||||||
@@ -101,11 +107,20 @@ export function getCompatibilityWarnings(): StartupWarning[] {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isJetBrainsTerminal()) {
|
if (isJetBrainsTerminal() && options.useAlternateBuffer) {
|
||||||
|
let suggestedTerminals = '';
|
||||||
|
const platform = os.platform();
|
||||||
|
if (platform === 'win32') {
|
||||||
|
suggestedTerminals = 'Windows Terminal';
|
||||||
|
} else if (platform === 'darwin') {
|
||||||
|
suggestedTerminals = 'iTerm2, Ghostty';
|
||||||
|
} else {
|
||||||
|
suggestedTerminals = 'Ghostty';
|
||||||
|
}
|
||||||
|
|
||||||
warnings.push({
|
warnings.push({
|
||||||
id: 'jetbrains-terminal',
|
id: 'jetbrains-terminal',
|
||||||
message:
|
message: `Warning: JetBrains terminal detected. Jetbrains mouse scrolling physics has strange bouncing behavior. Using an external terminal (e.g., ${suggestedTerminals}) is recommended.`,
|
||||||
'Warning: JetBrains terminal detected. You may experience rendering or scrolling issues. Using an external terminal (e.g., Windows Terminal, iTerm2) is recommended.',
|
|
||||||
priority: WarningPriority.High,
|
priority: WarningPriority.High,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user