mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
Fix modifyOtherKeys enablement on unsupported terminals (#16714)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -277,7 +277,7 @@ describe('TerminalCapabilityManager', () => {
|
|||||||
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should infer modifyOtherKeys support from Device Attributes (DA1) alone', async () => {
|
it('should not enable modifyOtherKeys without explicit response', async () => {
|
||||||
const manager = TerminalCapabilityManager.getInstance();
|
const manager = TerminalCapabilityManager.getInstance();
|
||||||
const promise = manager.detectCapabilities();
|
const promise = manager.detectCapabilities();
|
||||||
|
|
||||||
@@ -287,9 +287,7 @@ describe('TerminalCapabilityManager', () => {
|
|||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
expect(manager.isKittyProtocolEnabled()).toBe(false);
|
expect(manager.isKittyProtocolEnabled()).toBe(false);
|
||||||
// It should fall back to modifyOtherKeys because DA1 proves it's an ANSI terminal
|
expect(enableModifyOtherKeys).not.toHaveBeenCalled();
|
||||||
|
|
||||||
expect(enableModifyOtherKeys).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,9 +47,8 @@ export class TerminalCapabilityManager {
|
|||||||
private terminalBackgroundColor: TerminalBackgroundColor;
|
private terminalBackgroundColor: TerminalBackgroundColor;
|
||||||
private kittySupported = false;
|
private kittySupported = false;
|
||||||
private kittyEnabled = false;
|
private kittyEnabled = false;
|
||||||
|
private modifyOtherKeysSupported = false;
|
||||||
private terminalName: string | undefined;
|
private terminalName: string | undefined;
|
||||||
private modifyOtherKeysSupported?: boolean;
|
|
||||||
private deviceAttributesSupported = false;
|
|
||||||
|
|
||||||
private constructor() {}
|
private constructor() {}
|
||||||
|
|
||||||
@@ -186,7 +185,6 @@ export class TerminalCapabilityManager {
|
|||||||
);
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
deviceAttributesReceived = true;
|
deviceAttributesReceived = true;
|
||||||
this.deviceAttributesSupported = true;
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,13 +213,7 @@ export class TerminalCapabilityManager {
|
|||||||
if (this.kittySupported) {
|
if (this.kittySupported) {
|
||||||
enableKittyKeyboardProtocol();
|
enableKittyKeyboardProtocol();
|
||||||
this.kittyEnabled = true;
|
this.kittyEnabled = true;
|
||||||
} else if (
|
} else if (this.modifyOtherKeysSupported) {
|
||||||
this.modifyOtherKeysSupported === true ||
|
|
||||||
// If device attributes were received it's safe to try enabling
|
|
||||||
// anyways, since it will be ignored if unsupported
|
|
||||||
(this.modifyOtherKeysSupported === undefined &&
|
|
||||||
this.deviceAttributesSupported)
|
|
||||||
) {
|
|
||||||
enableModifyOtherKeys();
|
enableModifyOtherKeys();
|
||||||
}
|
}
|
||||||
// Always enable bracketed paste since it'll be ignored if unsupported.
|
// Always enable bracketed paste since it'll be ignored if unsupported.
|
||||||
|
|||||||
Reference in New Issue
Block a user