@xterm/xterm 6.1.0-beta.201 → 6.1.0-beta.203

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.201",
4
+ "version": "6.1.0-beta.203",
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": "7fe89a1c1a9139e752d92a75da876823882a7a45"
122
+ "commit": "9c5420371b956f083562de202e7d1e2eb5963034"
123
123
  }
@@ -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.201';
9
+ export const XTERM_VERSION = '6.1.0-beta.203';
@@ -247,6 +247,8 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
247
247
  // handler lookup containers
248
248
  protected _printHandler: PrintHandlerType;
249
249
  protected _executeHandlers: { [flag: number]: ExecuteHandlerType };
250
+ // fast path for EXE bytes < 0x18
251
+ protected _executeHandlersArr: (ExecuteHandlerType | undefined)[];
250
252
  protected _csiHandlers: IHandlerCollection<CsiHandlerType>;
251
253
  protected _escHandlers: IHandlerCollection<EscHandlerType>;
252
254
  protected readonly _oscParser: IOscParser;
@@ -290,11 +292,13 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
290
292
  this._errorHandlerFb = (state: IParsingState): IParsingState => state;
291
293
  this._printHandler = this._printHandlerFb;
292
294
  this._executeHandlers = Object.create(null);
295
+ this._executeHandlersArr = new Array(0x18).fill(undefined);
293
296
  this._csiHandlers = Object.create(null);
294
297
  this._escHandlers = Object.create(null);
295
298
  this._register(toDisposable(() => {
296
299
  this._csiHandlers = Object.create(null);
297
300
  this._executeHandlers = Object.create(null);
301
+ this._executeHandlersArr = new Array(0x18).fill(undefined);
298
302
  this._escHandlers = Object.create(null);
299
303
  }));
300
304
  this._oscParser = this._register(new OscParser());
@@ -381,10 +385,14 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
381
385
  }
382
386
 
383
387
  public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {
384
- this._executeHandlers[flag.charCodeAt(0)] = handler;
388
+ const code = flag.charCodeAt(0);
389
+ this._executeHandlers[code] = handler;
390
+ if (code < 0x18) this._executeHandlersArr[code] = handler;
385
391
  }
386
392
  public clearExecuteHandler(flag: string): void {
387
- if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];
393
+ const code = flag.charCodeAt(0);
394
+ if (this._executeHandlers[code]) delete this._executeHandlers[code];
395
+ if (code < 0x18) this._executeHandlersArr[code] = undefined;
388
396
  }
389
397
  public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {
390
398
  this._executeHandlerFb = handler;
@@ -651,8 +659,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
651
659
 
652
660
  // EXE fast-path: common control bytes (0x00-0x17) in non-payload states
653
661
  if (code < 0x18 && this.currentState <= ParserState.CSI_IGNORE) {
654
- if (this._executeHandlers[code]) this._executeHandlers[code]();
655
- else this._executeHandlerFb(code);
662
+ (this._executeHandlersArr[code] ?? this._executeHandlerFb)(code);
656
663
  this.precedingJoinState = 0;
657
664
  continue;
658
665
  }
@@ -108,7 +108,7 @@ export type EscFallbackHandlerType = (identifier: number) => void;
108
108
  /**
109
109
  * EXECUTE handler types.
110
110
  */
111
- export type ExecuteHandlerType = () => boolean;
111
+ export type ExecuteHandlerType = (ident?: number) => boolean;
112
112
  export type ExecuteFallbackHandlerType = (ident: number) => void;
113
113
 
114
114
  /**