@xterm/xterm 6.1.0-beta.214 → 6.1.0-beta.216

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.
@@ -4,10 +4,16 @@
4
4
  */
5
5
  import { IParams, ParamsArray } from 'common/parser/Types';
6
6
 
7
- // max value supported for a single param/subparam (clamped to positive int32 range)
8
- const MAX_VALUE = 0x7FFFFFFF;
9
- // max allowed subparams for a single sequence (hardcoded limitation)
10
- const MAX_SUBPARAMS = 256;
7
+ const enum Constants {
8
+ /**
9
+ * Max value supported for a single param/subparam (clamped to positive int32 range)
10
+ */
11
+ MAX_VALUE = 0x7FFFFFFF,
12
+ /**
13
+ * Max allowed subparams for a single sequence (hardcoded limitation)
14
+ */
15
+ MAX_SUBPARAMS = 256
16
+ }
11
17
 
12
18
  /**
13
19
  * Params storage class.
@@ -70,7 +76,7 @@ export class Params implements IParams {
70
76
  * @param maxSubParamsLength max length of storable sub parameters
71
77
  */
72
78
  constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {
73
- if (maxSubParamsLength > MAX_SUBPARAMS) {
79
+ if (maxSubParamsLength > Constants.MAX_SUBPARAMS) {
74
80
  throw new Error('maxSubParamsLength must not be greater than 256');
75
81
  }
76
82
  this.params = new Int32Array(maxLength);
@@ -159,7 +165,7 @@ export class Params implements IParams {
159
165
  throw new Error('values lesser than -1 are not allowed');
160
166
  }
161
167
  this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;
162
- this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;
168
+ this.params[this.length++] = value > Constants.MAX_VALUE ? Constants.MAX_VALUE : value;
163
169
  }
164
170
 
165
171
  /**
@@ -181,7 +187,7 @@ export class Params implements IParams {
181
187
  if (value < -1) {
182
188
  throw new Error('values lesser than -1 are not allowed');
183
189
  }
184
- this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;
190
+ this._subParams[this._subParamsLength++] = value > Constants.MAX_VALUE ? Constants.MAX_VALUE : value;
185
191
  this._subParamsIdx[this.length - 1]++;
186
192
  }
187
193
 
@@ -237,6 +243,6 @@ export class Params implements IParams {
237
243
 
238
244
  const store = this._digitIsSub ? this._subParams : this.params;
239
245
  const cur = store[length - 1];
240
- store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;
246
+ store[length - 1] = ~cur ? Math.min(cur * 10 + value, Constants.MAX_VALUE) : value;
241
247
  }
242
248
  }
@@ -10,8 +10,10 @@ import { IBuffer, IBufferSet } from 'common/buffer/Types';
10
10
  import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';
11
11
  import { Emitter } from 'common/Event';
12
12
 
13
- export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
14
- export const MINIMUM_ROWS = 1;
13
+ export const enum BufferServiceConstants {
14
+ MINIMUM_COLS = 2, // Less than 2 can mess with wide chars
15
+ MINIMUM_ROWS = 1
16
+ }
15
17
 
16
18
  export class BufferService extends Disposable implements IBufferService {
17
19
  public serviceBrand: any;
@@ -37,8 +39,8 @@ export class BufferService extends Disposable implements IBufferService {
37
39
  @ILogService logService: ILogService
38
40
  ) {
39
41
  super();
40
- this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);
41
- this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);
42
+ this.cols = Math.max(optionsService.rawOptions.cols || 0, BufferServiceConstants.MINIMUM_COLS);
43
+ this.rows = Math.max(optionsService.rawOptions.rows || 0, BufferServiceConstants.MINIMUM_ROWS);
42
44
  this.buffers = this._register(new BufferSet(optionsService, this, logService));
43
45
  this._register(this.buffers.onBufferActivate(e => {
44
46
  this._onScroll.fire(e.activeBuffer.ydisp);
@@ -11,13 +11,15 @@
11
11
 
12
12
  import { IServiceIdentifier } from 'common/services/Services';
13
13
 
14
- const DI_TARGET = 'di$target';
15
- const DI_DEPENDENCIES = 'di$dependencies';
14
+ const enum Constants {
15
+ DI_TARGET = 'di$target',
16
+ DI_DEPENDENCIES = 'di$dependencies'
17
+ }
16
18
 
17
19
  export const serviceRegistry: Map<string, IServiceIdentifier<any>> = new Map();
18
20
 
19
21
  export function getServiceDependencies(ctor: any): { id: IServiceIdentifier<any>, index: number, optional: boolean }[] {
20
- return ctor[DI_DEPENDENCIES] || [];
22
+ return ctor[Constants.DI_DEPENDENCIES] || [];
21
23
  }
22
24
 
23
25
  export function createDecorator<T>(id: string): IServiceIdentifier<T> {
@@ -40,10 +42,10 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
40
42
  }
41
43
 
42
44
  function storeServiceDependency(id: Function, target: Function, index: number): void {
43
- if ((target as any)[DI_TARGET] === target) {
44
- (target as any)[DI_DEPENDENCIES].push({ id, index });
45
+ if ((target as any)[Constants.DI_TARGET] === target) {
46
+ (target as any)[Constants.DI_DEPENDENCIES].push({ id, index });
45
47
  } else {
46
- (target as any)[DI_DEPENDENCIES] = [{ id, index }];
47
- (target as any)[DI_TARGET] = target;
48
+ (target as any)[Constants.DI_DEPENDENCIES] = [{ id, index }];
49
+ (target as any)[Constants.DI_TARGET] = target;
48
50
  }
49
51
  }