mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-19 09:41:17 -07:00
fix(ui): add accelerated scrolling on alternate buffer mode (#23940)
Co-authored-by: jacob314 <jacob314@gmail.com>
This commit is contained in:
@@ -322,6 +322,49 @@ describe('TerminalCapabilityManager', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isGhosttyTerminal', () => {
|
||||
const manager = TerminalCapabilityManager.getInstance();
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: 'Ghostty (terminal name)',
|
||||
terminalName: 'Ghostty',
|
||||
env: {},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: 'ghostty (TERM_PROGRAM)',
|
||||
terminalName: undefined,
|
||||
env: { TERM_PROGRAM: 'ghostty' },
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: 'xterm-ghostty (TERM)',
|
||||
terminalName: undefined,
|
||||
env: { TERM: 'xterm-ghostty' },
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: 'iTerm.app (TERM_PROGRAM)',
|
||||
terminalName: undefined,
|
||||
env: { TERM_PROGRAM: 'iTerm.app' },
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: 'undefined env',
|
||||
terminalName: undefined,
|
||||
env: {},
|
||||
expected: false,
|
||||
},
|
||||
])(
|
||||
'should return $expected for $name',
|
||||
({ terminalName, env, expected }) => {
|
||||
vi.spyOn(manager, 'getTerminalName').mockReturnValue(terminalName);
|
||||
expect(manager.isGhosttyTerminal(env)).toBe(expected);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('supportsOsc9Notifications', () => {
|
||||
const manager = TerminalCapabilityManager.getInstance();
|
||||
|
||||
|
||||
@@ -272,6 +272,18 @@ export class TerminalCapabilityManager {
|
||||
return this.kittyEnabled;
|
||||
}
|
||||
|
||||
isGhosttyTerminal(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
const termProgram = env['TERM_PROGRAM']?.toLowerCase();
|
||||
const term = env['TERM']?.toLowerCase();
|
||||
const name = this.getTerminalName()?.toLowerCase();
|
||||
|
||||
return !!(
|
||||
name?.includes('ghostty') ||
|
||||
termProgram?.includes('ghostty') ||
|
||||
term?.includes('ghostty')
|
||||
);
|
||||
}
|
||||
|
||||
supportsOsc9Notifications(env: NodeJS.ProcessEnv = process.env): boolean {
|
||||
if (env['WT_SESSION']) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user