@xterm/xterm 6.1.0-beta.196 → 6.1.0-beta.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "6.1.0-beta.196",
4
+ "version": "6.1.0-beta.198",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -119,5 +119,5 @@
119
119
  "ws": "^8.2.3",
120
120
  "xterm-benchmark": "^0.3.1"
121
121
  },
122
- "commit": "43162634574514212b759cd0c41e82dc3ce92410"
122
+ "commit": "62ce318a075838c05db9ff9a3e4db33f3f1515ca"
123
123
  }
@@ -94,6 +94,12 @@ export class OverviewRulerRenderer extends Disposable {
94
94
  this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
95
95
  this._register(this._optionsService.onSpecificOptionChange('scrollbar', () => this._queueRefresh(true)));
96
96
  this._register(this._themeService.onChangeColors(() => this._queueRefresh()));
97
+ this._register(toDisposable(() => {
98
+ if (this._animationFrame !== undefined) {
99
+ this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
100
+ this._animationFrame = undefined;
101
+ }
102
+ }));
97
103
  this._queueRefresh(true);
98
104
  }
99
105
 
@@ -136,6 +142,9 @@ export class OverviewRulerRenderer extends Disposable {
136
142
  }
137
143
 
138
144
  private _refreshCanvasDimensions(): void {
145
+ if (this._store.isDisposed || !this._renderService.hasRenderer()) {
146
+ return;
147
+ }
139
148
  const cssCanvasHeight = this._renderService.dimensions.css.canvas.height;
140
149
  const deviceCanvasHeight = this._renderService.dimensions.device.canvas.height;
141
150
  this._canvas.style.width = `${this._width}px`;
@@ -147,6 +156,9 @@ export class OverviewRulerRenderer extends Disposable {
147
156
  }
148
157
 
149
158
  private _refreshDecorations(): void {
159
+ if (this._store.isDisposed || !this._renderService.hasRenderer()) {
160
+ return;
161
+ }
150
162
  if (this._shouldUpdateDimensions) {
151
163
  this._refreshCanvasDimensions();
152
164
  }
@@ -200,13 +212,18 @@ export class OverviewRulerRenderer extends Disposable {
200
212
  }
201
213
 
202
214
  private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {
215
+ if (this._store.isDisposed) {
216
+ return;
217
+ }
203
218
  this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;
204
219
  this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;
205
220
  if (this._animationFrame !== undefined) {
206
221
  return;
207
222
  }
208
223
  this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
209
- this._refreshDecorations();
224
+ if (!this._store.isDisposed) {
225
+ this._refreshDecorations();
226
+ }
210
227
  this._animationFrame = undefined;
211
228
  });
212
229
  }
@@ -40,7 +40,7 @@ export class KeyboardService implements IKeyboardService {
40
40
  }
41
41
  const kittyFlags = this._coreService.kittyKeyboard.flags;
42
42
  return this.useKitty
43
- ? this._getKittyKeyboard().evaluate(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS)
43
+ ? this._getKittyKeyboard().evaluate(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS, isMac && this._optionsService.rawOptions.macOptionIsMeta)
44
44
  : evaluateKeyboardEvent(event, this._coreService.decPrivateModes.applicationCursorKeys, isMac, this._optionsService.rawOptions.macOptionIsMeta);
45
45
  }
46
46
 
@@ -51,7 +51,7 @@ export class KeyboardService implements IKeyboardService {
51
51
  }
52
52
  const kittyFlags = this._coreService.kittyKeyboard.flags;
53
53
  if (this.useKitty && (kittyFlags & KittyKeyboardFlags.REPORT_EVENT_TYPES)) {
54
- return this._getKittyKeyboard().evaluate(event, kittyFlags, KittyKeyboardEventType.RELEASE);
54
+ return this._getKittyKeyboard().evaluate(event, kittyFlags, KittyKeyboardEventType.RELEASE, isMac && this._optionsService.rawOptions.macOptionIsMeta);
55
55
  }
56
56
  return undefined;
57
57
  }
@@ -6,4 +6,4 @@
6
6
  /**
7
7
  * The xterm.js version. This is updated by the publish script from package.json.
8
8
  */
9
- export const XTERM_VERSION = '6.1.0-beta.196';
9
+ export const XTERM_VERSION = '6.1.0-beta.198';
@@ -218,7 +218,7 @@ export class KittyKeyboard {
218
218
  * Returns the lowercase codepoint for letters.
219
219
  * For shifted keys, uses the code property to get the base key.
220
220
  */
221
- private _getKeyCode(ev: IKeyboardEvent): number | undefined {
221
+ private _getKeyCode(ev: IKeyboardEvent, macOptionAsAlt: boolean): number | undefined {
222
222
  const numpadCode = this._getNumpadKeyCode(ev);
223
223
  if (numpadCode !== undefined) {
224
224
  return numpadCode;
@@ -234,7 +234,7 @@ export class KittyKeyboard {
234
234
  return funcCode;
235
235
  }
236
236
 
237
- if (ev.shiftKey && ev.code) {
237
+ if ((ev.shiftKey || (macOptionAsAlt && ev.altKey)) && ev.code) {
238
238
  if (ev.code.startsWith('Digit') && ev.code.length === 6) {
239
239
  const digit = ev.code.charAt(5);
240
240
  if (digit >= '0' && digit <= '9') {
@@ -410,12 +410,14 @@ export class KittyKeyboard {
410
410
  * @param ev The keyboard event.
411
411
  * @param flags The active Kitty keyboard enhancement flags.
412
412
  * @param eventType The event type (press, repeat, release).
413
+ * @param macOptionAsAlt When true, macOS Option-composed ev.key values are unwound via ev.code.
413
414
  * @returns The keyboard result with the encoded key sequence.
414
415
  */
415
416
  public evaluate(
416
417
  ev: IKeyboardEvent,
417
418
  flags: number,
418
- eventType: KittyKeyboardEventType = KittyKeyboardEventType.PRESS
419
+ eventType: KittyKeyboardEventType = KittyKeyboardEventType.PRESS,
420
+ macOptionAsAlt: boolean = false
419
421
  ): IKeyboardResult {
420
422
  const result: IKeyboardResult = {
421
423
  type: KeyboardResultType.SEND_KEY,
@@ -464,7 +466,7 @@ export class KittyKeyboard {
464
466
  return result;
465
467
  }
466
468
 
467
- const keyCode = this._getKeyCode(ev);
469
+ const keyCode = this._getKeyCode(ev, macOptionAsAlt);
468
470
  if (keyCode === undefined) {
469
471
  return result;
470
472
  }