mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 03:54:43 -07:00
Infer modifyOtherKeys support (#16270)
This commit is contained in:
committed by
GitHub
parent
c7d17dda49
commit
ea7393f7fd
@@ -43,14 +43,13 @@ export class TerminalCapabilityManager {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
private static readonly MODIFY_OTHER_KEYS_REGEX = /\x1b\[>4;(\d+)m/;
|
||||
|
||||
private detectionComplete = false;
|
||||
private terminalBackgroundColor: TerminalBackgroundColor;
|
||||
private kittySupported = false;
|
||||
private kittyEnabled = false;
|
||||
private detectionComplete = false;
|
||||
private terminalName: string | undefined;
|
||||
private modifyOtherKeysSupported = false;
|
||||
private modifyOtherKeysEnabled = false;
|
||||
private bracketedPasteEnabled = false;
|
||||
private modifyOtherKeysSupported?: boolean;
|
||||
private deviceAttributesSupported = false;
|
||||
|
||||
private constructor() {}
|
||||
|
||||
@@ -187,6 +186,7 @@ export class TerminalCapabilityManager {
|
||||
);
|
||||
if (match) {
|
||||
deviceAttributesReceived = true;
|
||||
this.deviceAttributesSupported = true;
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
@@ -215,13 +215,17 @@ export class TerminalCapabilityManager {
|
||||
if (this.kittySupported) {
|
||||
enableKittyKeyboardProtocol();
|
||||
this.kittyEnabled = true;
|
||||
} else if (this.modifyOtherKeysSupported) {
|
||||
} else if (
|
||||
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();
|
||||
this.modifyOtherKeysEnabled = true;
|
||||
}
|
||||
// Always enable bracketed paste since it'll be ignored if unsupported.
|
||||
enableBracketedPasteMode();
|
||||
this.bracketedPasteEnabled = true;
|
||||
} catch (e) {
|
||||
debugLogger.warn('Failed to enable keyboard protocols:', e);
|
||||
}
|
||||
@@ -239,14 +243,6 @@ export class TerminalCapabilityManager {
|
||||
return this.kittyEnabled;
|
||||
}
|
||||
|
||||
isBracketedPasteEnabled(): boolean {
|
||||
return this.bracketedPasteEnabled;
|
||||
}
|
||||
|
||||
isModifyOtherKeysEnabled(): boolean {
|
||||
return this.modifyOtherKeysEnabled;
|
||||
}
|
||||
|
||||
private parseColor(rHex: string, gHex: string, bHex: string): string {
|
||||
const parseComponent = (hex: string) => {
|
||||
const val = parseInt(hex, 16);
|
||||
|
||||
Reference in New Issue
Block a user