Hook up vt extensions option
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ if (files.length === 0) {
|
|||||||
|
|
||||||
console.log(`Linting ${files.length} changed file(s)...`);
|
console.log(`Linting ${files.length} changed file(s)...`);
|
||||||
|
|
||||||
const eslintArgs = ['--max-warnings', '0'];
|
const eslintArgs = ['--max-warnings', '0', '--no-warn-ignored'];
|
||||||
if (fix) {
|
if (fix) {
|
||||||
eslintArgs.push('--fix');
|
eslintArgs.push('--fix');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1087,7 +1087,8 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
|
|
||||||
// Use Kitty keyboard protocol if enabled, otherwise use legacy encoding
|
// Use Kitty keyboard protocol if enabled, otherwise use legacy encoding
|
||||||
const kittyFlags = this.coreService.kittyKeyboard.flags;
|
const kittyFlags = this.coreService.kittyKeyboard.flags;
|
||||||
const result = shouldUseKittyProtocol(kittyFlags)
|
const useKitty = this.options.vtExtensions?.kittyKeyboard && shouldUseKittyProtocol(kittyFlags);
|
||||||
|
const result = useKitty
|
||||||
? evaluateKeyboardEventKitty(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS)
|
? evaluateKeyboardEventKitty(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS)
|
||||||
: evaluateKeyboardEvent(event, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
|
: evaluateKeyboardEvent(event, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
|
||||||
|
|
||||||
@@ -1178,7 +1179,8 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
|
|
||||||
// Handle key release for Kitty keyboard protocol
|
// Handle key release for Kitty keyboard protocol
|
||||||
const kittyFlags = this.coreService.kittyKeyboard.flags;
|
const kittyFlags = this.coreService.kittyKeyboard.flags;
|
||||||
if (shouldUseKittyProtocol(kittyFlags) && (kittyFlags & 0b10)) { // REPORT_EVENT_TYPES flag
|
const useKitty = this.options.vtExtensions?.kittyKeyboard && shouldUseKittyProtocol(kittyFlags);
|
||||||
|
if (useKitty && (kittyFlags & 0b10)) { // REPORT_EVENT_TYPES flag
|
||||||
const result = evaluateKeyboardEventKitty(ev, kittyFlags, KittyKeyboardEventType.RELEASE);
|
const result = evaluateKeyboardEventKitty(ev, kittyFlags, KittyKeyboardEventType.RELEASE);
|
||||||
if (result.key) {
|
if (result.key) {
|
||||||
this.coreService.triggerDataEvent(result.key, true);
|
this.coreService.triggerDataEvent(result.key, true);
|
||||||
|
|||||||
@@ -2992,6 +2992,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* @vt: #Y CSI KKBDSET "Kitty Keyboard Set" "CSI = Ps ; Pm u" "Set Kitty keyboard protocol flags."
|
* @vt: #Y CSI KKBDSET "Kitty Keyboard Set" "CSI = Ps ; Pm u" "Set Kitty keyboard protocol flags."
|
||||||
*/
|
*/
|
||||||
public kittyKeyboardSet(params: IParams): boolean {
|
public kittyKeyboardSet(params: IParams): boolean {
|
||||||
|
if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const flags = params.params[0] || 0;
|
const flags = params.params[0] || 0;
|
||||||
const mode = params.params[1] || 1;
|
const mode = params.params[1] || 1;
|
||||||
const state = this._coreService.kittyKeyboard;
|
const state = this._coreService.kittyKeyboard;
|
||||||
@@ -3018,6 +3021,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* @vt: #Y CSI KKBDQUERY "Kitty Keyboard Query" "CSI ? u" "Query Kitty keyboard protocol flags."
|
* @vt: #Y CSI KKBDQUERY "Kitty Keyboard Query" "CSI ? u" "Query Kitty keyboard protocol flags."
|
||||||
*/
|
*/
|
||||||
public kittyKeyboardQuery(params: IParams): boolean {
|
public kittyKeyboardQuery(params: IParams): boolean {
|
||||||
|
if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const flags = this._coreService.kittyKeyboard.flags;
|
const flags = this._coreService.kittyKeyboard.flags;
|
||||||
this._coreService.triggerDataEvent(`${C0.ESC}[?${flags}u`);
|
this._coreService.triggerDataEvent(`${C0.ESC}[?${flags}u`);
|
||||||
return true;
|
return true;
|
||||||
@@ -3030,6 +3036,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* @vt: #Y CSI KKBDPUSH "Kitty Keyboard Push" "CSI > Ps u" "Push keyboard flags to stack and set new flags."
|
* @vt: #Y CSI KKBDPUSH "Kitty Keyboard Push" "CSI > Ps u" "Push keyboard flags to stack and set new flags."
|
||||||
*/
|
*/
|
||||||
public kittyKeyboardPush(params: IParams): boolean {
|
public kittyKeyboardPush(params: IParams): boolean {
|
||||||
|
if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const flags = params.params[0] || 0;
|
const flags = params.params[0] || 0;
|
||||||
const state = this._coreService.kittyKeyboard;
|
const state = this._coreService.kittyKeyboard;
|
||||||
const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;
|
const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;
|
||||||
@@ -3048,6 +3057,9 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* @vt: #Y CSI KKBDPOP "Kitty Keyboard Pop" "CSI < Ps u" "Pop keyboard flags from stack."
|
* @vt: #Y CSI KKBDPOP "Kitty Keyboard Pop" "CSI < Ps u" "Pop keyboard flags from stack."
|
||||||
*/
|
*/
|
||||||
public kittyKeyboardPop(params: IParams): boolean {
|
public kittyKeyboardPop(params: IParams): boolean {
|
||||||
|
if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const count = Math.max(1, params.params[0] || 1);
|
const count = Math.max(1, params.params[0] || 1);
|
||||||
const state = this._coreService.kittyKeyboard;
|
const state = this._coreService.kittyKeyboard;
|
||||||
const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;
|
const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|||||||
termName: 'xterm',
|
termName: 'xterm',
|
||||||
cancelEvents: false,
|
cancelEvents: false,
|
||||||
overviewRuler: {},
|
overviewRuler: {},
|
||||||
quirks: {}
|
quirks: {},
|
||||||
|
vtExtensions: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
|
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ export interface ITerminalOptions {
|
|||||||
overviewRuler?: IOverviewRulerOptions;
|
overviewRuler?: IOverviewRulerOptions;
|
||||||
quirks?: ITerminalQuirks;
|
quirks?: ITerminalQuirks;
|
||||||
scrollOnEraseInDisplay?: boolean;
|
scrollOnEraseInDisplay?: boolean;
|
||||||
|
vtExtensions?: IVtExtensions;
|
||||||
|
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
cancelEvents: boolean;
|
cancelEvents: boolean;
|
||||||
@@ -307,6 +308,10 @@ export interface ITerminalQuirks {
|
|||||||
allowSetCursorBlink?: boolean;
|
allowSetCursorBlink?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IVtExtensions {
|
||||||
|
kittyKeyboard?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export const IOscLinkService = createDecorator<IOscLinkService>('OscLinkService');
|
export const IOscLinkService = createDecorator<IOscLinkService>('OscLinkService');
|
||||||
export interface IOscLinkService {
|
export interface IOscLinkService {
|
||||||
serviceBrand: undefined;
|
serviceBrand: undefined;
|
||||||
|
|||||||
Vendored
+17
@@ -231,6 +231,11 @@ declare module '@xterm/headless' {
|
|||||||
* All features are disabled by default for security reasons.
|
* All features are disabled by default for security reasons.
|
||||||
*/
|
*/
|
||||||
windowOptions?: IWindowOptions;
|
windowOptions?: IWindowOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable various VT extensions. All extensions are disabled by default.
|
||||||
|
*/
|
||||||
|
vtExtensions?: IVtExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,6 +318,18 @@ declare module '@xterm/headless' {
|
|||||||
buildNumber?: number;
|
buildNumber?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable VT extensions that are not part of the core VT specification.
|
||||||
|
*/
|
||||||
|
export interface IVtExtensions {
|
||||||
|
/**
|
||||||
|
* Whether the kitty keyboard protocol is enabled. When enabled, the
|
||||||
|
* terminal will respond to keyboard protocol queries and allow programs to
|
||||||
|
* enable enhanced keyboard reporting. The default is false.
|
||||||
|
*/
|
||||||
|
kittyKeyboard?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A replacement logger for `console`.
|
* A replacement logger for `console`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+25
-6
@@ -199,6 +199,12 @@ declare module '@xterm/xterm' {
|
|||||||
*/
|
*/
|
||||||
minimumContrastRatio?: number;
|
minimumContrastRatio?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the visibility and style of the overview ruler which visualizes
|
||||||
|
* decorations underneath the scroll bar.
|
||||||
|
*/
|
||||||
|
overviewRuler?: IOverviewRulerOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control various quirks features that are either non-standard or standard
|
* Control various quirks features that are either non-standard or standard
|
||||||
* in but generally rejected in modern terminals.
|
* in but generally rejected in modern terminals.
|
||||||
@@ -284,6 +290,11 @@ declare module '@xterm/xterm' {
|
|||||||
*/
|
*/
|
||||||
theme?: ITheme;
|
theme?: ITheme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable various VT extensions. All extensions are disabled by default.
|
||||||
|
*/
|
||||||
|
vtExtensions?: IVtExtensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compatibility information when the pty is known to be hosted on Windows.
|
* Compatibility information when the pty is known to be hosted on Windows.
|
||||||
* Setting this will turn on certain heuristics/workarounds depending on the
|
* Setting this will turn on certain heuristics/workarounds depending on the
|
||||||
@@ -313,12 +324,6 @@ declare module '@xterm/xterm' {
|
|||||||
* All features are disabled by default for security reasons.
|
* All features are disabled by default for security reasons.
|
||||||
*/
|
*/
|
||||||
windowOptions?: IWindowOptions;
|
windowOptions?: IWindowOptions;
|
||||||
|
|
||||||
/**
|
|
||||||
* Controls the visibility and style of the overview ruler which visualizes
|
|
||||||
* decorations underneath the scroll bar.
|
|
||||||
*/
|
|
||||||
overviewRuler?: IOverviewRulerOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -430,6 +435,20 @@ declare module '@xterm/xterm' {
|
|||||||
allowSetCursorBlink?: boolean;
|
allowSetCursorBlink?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable certain optional VT extensions.
|
||||||
|
*/
|
||||||
|
export interface IVtExtensions {
|
||||||
|
/**
|
||||||
|
* Whether the [kitty keyboard protocol][0] (`CSI u`) is enabled. When
|
||||||
|
* enabled, the terminal will respond to keyboard protocol queries and allow
|
||||||
|
* programs to enable enhanced keyboard reporting. The default is false.
|
||||||
|
*
|
||||||
|
* [0]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
||||||
|
*/
|
||||||
|
kittyKeyboard?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pty information for Windows.
|
* Pty information for Windows.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user