mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
fix(cli): fix enabling kitty codes on Windows Terminal (#21136)
This commit is contained in:
committed by
GitHub
parent
09259a8ec4
commit
ddafd79661
@@ -786,6 +786,8 @@ export function KeypressProvider({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
terminalCapabilityManager.enableSupportedModes();
|
||||
|
||||
const wasRaw = stdin.isRaw;
|
||||
if (wasRaw === false) {
|
||||
setRawMode(true);
|
||||
|
||||
@@ -98,6 +98,7 @@ describe('TerminalCapabilityManager', () => {
|
||||
stdin.emit('data', Buffer.from('\x1b[?62c'));
|
||||
|
||||
await promise;
|
||||
manager.enableSupportedModes();
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -141,6 +142,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
// Should resolve without waiting for timeout
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(true);
|
||||
expect(manager.getTerminalBackgroundColor()).toBe('#000000');
|
||||
});
|
||||
@@ -156,6 +159,7 @@ describe('TerminalCapabilityManager', () => {
|
||||
vi.advanceTimersByTime(1000);
|
||||
|
||||
await promise;
|
||||
manager.enableSupportedModes();
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -167,6 +171,7 @@ describe('TerminalCapabilityManager', () => {
|
||||
stdin.emit('data', Buffer.from('\x1b[?62c'));
|
||||
|
||||
await promise;
|
||||
manager.enableSupportedModes();
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(false);
|
||||
});
|
||||
|
||||
@@ -181,6 +186,7 @@ describe('TerminalCapabilityManager', () => {
|
||||
stdin.emit('data', Buffer.from('\x1b[?62c'));
|
||||
|
||||
await promise;
|
||||
manager.enableSupportedModes();
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -196,6 +202,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -210,6 +218,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(enableModifyOtherKeys).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -224,6 +234,7 @@ describe('TerminalCapabilityManager', () => {
|
||||
stdin.emit('data', Buffer.from('\x1b[?62c'));
|
||||
|
||||
await promise;
|
||||
manager.enableSupportedModes();
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(true);
|
||||
|
||||
expect(enableKittyKeyboardProtocol).toHaveBeenCalled();
|
||||
@@ -241,6 +252,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(false);
|
||||
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
||||
});
|
||||
@@ -257,6 +270,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -272,6 +287,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(manager.getTerminalBackgroundColor()).toBe('#1a1a1a');
|
||||
expect(manager.getTerminalName()).toBe('tmux');
|
||||
|
||||
@@ -287,6 +304,8 @@ describe('TerminalCapabilityManager', () => {
|
||||
|
||||
await promise;
|
||||
|
||||
manager.enableSupportedModes();
|
||||
|
||||
expect(manager.isKittyProtocolEnabled()).toBe(false);
|
||||
expect(enableModifyOtherKeys).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -138,9 +138,6 @@ export class TerminalCapabilityManager {
|
||||
process.stdin.setRawMode(false);
|
||||
}
|
||||
this.detectionComplete = true;
|
||||
|
||||
this.enableSupportedModes();
|
||||
|
||||
resolve();
|
||||
};
|
||||
|
||||
@@ -246,9 +243,11 @@ export class TerminalCapabilityManager {
|
||||
enableSupportedModes() {
|
||||
try {
|
||||
if (this.kittySupported) {
|
||||
debugLogger.log('Enabling Kitty keyboard protocol');
|
||||
enableKittyKeyboardProtocol();
|
||||
this.kittyEnabled = true;
|
||||
} else if (this.modifyOtherKeysSupported) {
|
||||
debugLogger.log('Enabling modifyOtherKeys');
|
||||
enableModifyOtherKeys();
|
||||
}
|
||||
// Always enable bracketed paste since it'll be ignored if unsupported.
|
||||
|
||||
Reference in New Issue
Block a user