fix(ui): add accelerated scrolling on alternate buffer mode (#23940)

Co-authored-by: jacob314 <jacob314@gmail.com>
This commit is contained in:
Dev Randalpura
2026-04-01 12:23:40 -04:00
committed by GitHub
parent 7d1848d578
commit 066da2a1d1
4 changed files with 246 additions and 3 deletions

View File

@@ -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();

View File

@@ -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;