mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-17 15:23:08 -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'],
|
||||
});
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,11 @@ export async function getUserStartupWarnings(
|
||||
const warnings = results.filter((w): w is StartupWarning => w !== null);
|
||||
|
||||
if (settings.ui?.showCompatibilityWarnings !== false) {
|
||||
warnings.push(...getCompatibilityWarnings());
|
||||
warnings.push(
|
||||
...getCompatibilityWarnings({
|
||||
useAlternateBuffer: settings.ui?.useAlternateBuffer !== false,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
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.stubEnv('TERMINAL_EMULATOR', 'JetBrains-JediTerm');
|
||||
|
||||
const warnings = getCompatibilityWarnings();
|
||||
const warnings = getCompatibilityWarnings({ useAlternateBuffer: true });
|
||||
expect(warnings).toContainEqual(
|
||||
expect.objectContaining({
|
||||
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', () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux');
|
||||
vi.stubEnv('TERMINAL_EMULATOR', '');
|
||||
@@ -201,7 +211,7 @@ describe('compatibility', () => {
|
||||
vi.stubEnv('TERM_PROGRAM', 'xterm');
|
||||
process.stdout.getColorDepth = vi.fn().mockReturnValue(8);
|
||||
|
||||
const warnings = getCompatibilityWarnings();
|
||||
const warnings = getCompatibilityWarnings({ useAlternateBuffer: true });
|
||||
expect(warnings).toHaveLength(3);
|
||||
expect(warnings[0].message).toContain('Windows 10 detected');
|
||||
expect(warnings[1].message).toContain('JetBrains terminal detected');
|
||||
|
||||
@@ -89,7 +89,13 @@ export interface StartupWarning {
|
||||
priority: WarningPriority;
|
||||
}
|
||||
|
||||
export function getCompatibilityWarnings(): StartupWarning[] {
|
||||
export interface CompatibilityOptions {
|
||||
useAlternateBuffer?: boolean;
|
||||
}
|
||||
|
||||
export function getCompatibilityWarnings(
|
||||
options: CompatibilityOptions = {},
|
||||
): StartupWarning[] {
|
||||
const warnings: StartupWarning[] = [];
|
||||
|
||||
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({
|
||||
id: 'jetbrains-terminal',
|
||||
message:
|
||||
'Warning: JetBrains terminal detected. You may experience rendering or scrolling issues. Using an external terminal (e.g., Windows Terminal, iTerm2) is recommended.',
|
||||
message: `Warning: JetBrains terminal detected. Jetbrains mouse scrolling physics has strange bouncing behavior. Using an external terminal (e.g., ${suggestedTerminals}) is recommended.`,
|
||||
priority: WarningPriority.High,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user