@xterm/xterm 6.1.0-beta.28 → 6.1.0-beta.281

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.
Files changed (181) hide show
  1. package/README.md +62 -38
  2. package/css/xterm.css +29 -22
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +8 -34
  6. package/lib/xterm.mjs.map +4 -4
  7. package/package.json +56 -45
  8. package/src/browser/AccessibilityManager.ts +18 -13
  9. package/src/browser/Clipboard.ts +8 -5
  10. package/src/browser/ColorContrastCache.ts +3 -3
  11. package/src/browser/CoreBrowserTerminal.ts +179 -348
  12. package/src/browser/Dom.ts +178 -0
  13. package/src/browser/Linkifier.ts +14 -14
  14. package/src/browser/OscLinkProvider.ts +86 -18
  15. package/src/browser/RenderDebouncer.ts +7 -9
  16. package/src/browser/TimeBasedDebouncer.ts +12 -5
  17. package/src/browser/Types.ts +16 -14
  18. package/src/browser/Viewport.ts +58 -23
  19. package/src/browser/decorations/BufferDecorationRenderer.ts +3 -3
  20. package/src/browser/decorations/ColorZoneStore.ts +1 -1
  21. package/src/browser/decorations/OverviewRulerRenderer.ts +36 -20
  22. package/src/browser/input/CompositionHelper.ts +47 -11
  23. package/src/browser/input/Mouse.ts +5 -9
  24. package/src/browser/input/MoveToCell.ts +3 -3
  25. package/src/browser/public/Terminal.ts +33 -36
  26. package/src/browser/renderer/dom/DomRenderer.ts +265 -89
  27. package/src/browser/renderer/dom/DomRendererRowFactory.ts +34 -27
  28. package/src/browser/renderer/dom/WidthCache.ts +57 -55
  29. package/src/browser/renderer/shared/Constants.ts +7 -0
  30. package/src/browser/renderer/shared/RendererUtils.ts +1 -1
  31. package/src/browser/renderer/shared/SelectionRenderModel.ts +2 -2
  32. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  33. package/src/browser/renderer/shared/Types.ts +10 -4
  34. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  35. package/src/browser/scrollable/fastDomNode.ts +126 -0
  36. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  37. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  38. package/src/browser/scrollable/mouseEvent.ts +292 -0
  39. package/src/browser/scrollable/scrollable.ts +486 -0
  40. package/src/browser/scrollable/scrollableElement.ts +581 -0
  41. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  42. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  43. package/src/browser/scrollable/scrollbarState.ts +246 -0
  44. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  45. package/src/browser/scrollable/touch.ts +485 -0
  46. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  47. package/src/browser/scrollable/widget.ts +23 -0
  48. package/src/browser/selection/SelectionModel.ts +1 -1
  49. package/src/browser/services/CharSizeService.ts +4 -4
  50. package/src/browser/services/CharacterJoinerService.ts +13 -11
  51. package/src/browser/services/CoreBrowserService.ts +7 -5
  52. package/src/browser/services/KeyboardService.ts +67 -0
  53. package/src/browser/services/LinkProviderService.ts +3 -3
  54. package/src/browser/services/MouseCoordsService.ts +47 -0
  55. package/src/browser/services/MouseService.ts +619 -23
  56. package/src/browser/services/RenderService.ts +33 -21
  57. package/src/browser/services/SelectionService.ts +72 -54
  58. package/src/browser/services/Services.ts +44 -21
  59. package/src/browser/services/ThemeService.ts +9 -9
  60. package/src/common/Async.ts +141 -0
  61. package/src/common/CircularList.ts +24 -3
  62. package/src/common/Color.ts +13 -5
  63. package/src/common/CoreTerminal.ts +61 -35
  64. package/src/common/Event.ts +118 -0
  65. package/src/common/InputHandler.ts +286 -105
  66. package/src/common/Lifecycle.ts +113 -0
  67. package/src/common/Platform.ts +15 -5
  68. package/src/common/SortedList.ts +8 -4
  69. package/src/common/StringBuilder.ts +67 -0
  70. package/src/common/TaskQueue.ts +17 -8
  71. package/src/common/Types.ts +68 -206
  72. package/src/common/Version.ts +1 -1
  73. package/src/common/WindowsMode.ts +2 -2
  74. package/src/common/buffer/AttributeData.ts +3 -2
  75. package/src/common/buffer/Buffer.ts +47 -32
  76. package/src/common/buffer/BufferLine.ts +175 -100
  77. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  78. package/src/common/buffer/BufferReflow.ts +7 -4
  79. package/src/common/buffer/BufferSet.ts +13 -9
  80. package/src/common/buffer/CellData.ts +61 -4
  81. package/src/common/buffer/Constants.ts +13 -13
  82. package/src/common/buffer/Marker.ts +4 -4
  83. package/src/common/buffer/Types.ts +153 -3
  84. package/src/common/data/Charsets.ts +4 -7
  85. package/src/common/data/EscapeSequences.ts +71 -70
  86. package/src/common/input/Keyboard.ts +17 -10
  87. package/src/common/input/KittyKeyboard.ts +526 -0
  88. package/src/common/input/TextDecoder.ts +3 -3
  89. package/src/common/input/UnicodeV6.ts +3 -2
  90. package/src/common/input/Win32InputMode.ts +297 -0
  91. package/src/common/input/WriteBuffer.ts +108 -39
  92. package/src/common/input/XParseColor.ts +2 -2
  93. package/src/common/parser/ApcParser.ts +196 -0
  94. package/src/common/parser/Constants.ts +14 -4
  95. package/src/common/parser/DcsParser.ts +15 -16
  96. package/src/common/parser/EscapeSequenceParser.ts +214 -72
  97. package/src/common/parser/OscParser.ts +14 -15
  98. package/src/common/parser/Params.ts +31 -12
  99. package/src/common/parser/Types.ts +40 -30
  100. package/src/common/public/BufferApiView.ts +3 -3
  101. package/src/common/public/BufferLineApiView.ts +4 -4
  102. package/src/common/public/BufferNamespaceApi.ts +5 -5
  103. package/src/common/public/ParserApi.ts +5 -2
  104. package/src/common/public/UnicodeApi.ts +1 -1
  105. package/src/common/services/BufferService.ts +17 -13
  106. package/src/common/services/CharsetService.ts +6 -2
  107. package/src/common/services/CoreService.ts +23 -10
  108. package/src/common/services/DecorationService.ts +260 -15
  109. package/src/common/services/InstantiationService.ts +2 -2
  110. package/src/common/services/LogService.ts +2 -32
  111. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +22 -133
  112. package/src/common/services/OptionsService.ts +17 -7
  113. package/src/common/services/OscLinkService.ts +3 -2
  114. package/src/common/services/ServiceRegistry.ts +14 -8
  115. package/src/common/services/Services.ts +54 -50
  116. package/src/common/services/UnicodeService.ts +6 -11
  117. package/typings/xterm.d.ts +329 -34
  118. package/src/common/Clone.ts +0 -23
  119. package/src/common/TypedArrayUtils.ts +0 -17
  120. package/src/vs/base/browser/browser.ts +0 -141
  121. package/src/vs/base/browser/canIUse.ts +0 -49
  122. package/src/vs/base/browser/dom.ts +0 -2369
  123. package/src/vs/base/browser/fastDomNode.ts +0 -316
  124. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  125. package/src/vs/base/browser/iframe.ts +0 -135
  126. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  127. package/src/vs/base/browser/mouseEvent.ts +0 -229
  128. package/src/vs/base/browser/touch.ts +0 -372
  129. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  130. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  131. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  132. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  133. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  134. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  135. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  136. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  137. package/src/vs/base/browser/ui/widget.ts +0 -57
  138. package/src/vs/base/browser/window.ts +0 -14
  139. package/src/vs/base/common/arrays.ts +0 -887
  140. package/src/vs/base/common/arraysFind.ts +0 -202
  141. package/src/vs/base/common/assert.ts +0 -71
  142. package/src/vs/base/common/async.ts +0 -1992
  143. package/src/vs/base/common/cancellation.ts +0 -148
  144. package/src/vs/base/common/charCode.ts +0 -450
  145. package/src/vs/base/common/collections.ts +0 -140
  146. package/src/vs/base/common/decorators.ts +0 -130
  147. package/src/vs/base/common/equals.ts +0 -146
  148. package/src/vs/base/common/errors.ts +0 -303
  149. package/src/vs/base/common/event.ts +0 -1778
  150. package/src/vs/base/common/functional.ts +0 -32
  151. package/src/vs/base/common/hash.ts +0 -316
  152. package/src/vs/base/common/iterator.ts +0 -159
  153. package/src/vs/base/common/keyCodes.ts +0 -526
  154. package/src/vs/base/common/keybindings.ts +0 -284
  155. package/src/vs/base/common/lazy.ts +0 -47
  156. package/src/vs/base/common/lifecycle.ts +0 -801
  157. package/src/vs/base/common/linkedList.ts +0 -142
  158. package/src/vs/base/common/map.ts +0 -202
  159. package/src/vs/base/common/numbers.ts +0 -98
  160. package/src/vs/base/common/observable.ts +0 -76
  161. package/src/vs/base/common/observableInternal/api.ts +0 -31
  162. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  163. package/src/vs/base/common/observableInternal/base.ts +0 -489
  164. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  165. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  166. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  167. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  168. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  169. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  170. package/src/vs/base/common/platform.ts +0 -281
  171. package/src/vs/base/common/scrollable.ts +0 -522
  172. package/src/vs/base/common/sequence.ts +0 -34
  173. package/src/vs/base/common/stopwatch.ts +0 -43
  174. package/src/vs/base/common/strings.ts +0 -557
  175. package/src/vs/base/common/symbols.ts +0 -9
  176. package/src/vs/base/common/uint.ts +0 -59
  177. package/src/vs/patches/nls.ts +0 -90
  178. package/src/vs/typings/base-common.d.ts +0 -20
  179. package/src/vs/typings/require.d.ts +0 -42
  180. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  181. package/src/vs/typings/vscode-globals-product.d.ts +0 -33
@@ -2,12 +2,18 @@
2
2
  * Copyright (c) 2019 The xterm.js authors. All rights reserved.
3
3
  * @license MIT
4
4
  */
5
- import { IParams, ParamsArray } from 'common/parser/Types';
5
+ import { IParams, ParamsArray } from './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);
@@ -129,6 +135,19 @@ export class Params implements IParams {
129
135
  this._digitIsSub = false;
130
136
  }
131
137
 
138
+ /**
139
+ * Reset and add 0 as first param (ZDM).
140
+ */
141
+ public resetZdm(): void {
142
+ this.length = 1;
143
+ this._subParamsLength = 0;
144
+ this._rejectDigits = false;
145
+ this._rejectSubDigits = false;
146
+ this._digitIsSub = false;
147
+ this._subParamsIdx[0] = 0;
148
+ this.params[0] = 0;
149
+ }
150
+
132
151
  /**
133
152
  * Add a parameter value.
134
153
  * `Params` only stores up to `maxLength` parameters, any later
@@ -143,17 +162,17 @@ export class Params implements IParams {
143
162
  return;
144
163
  }
145
164
  if (value < -1) {
146
- throw new Error('values lesser than -1 are not allowed');
165
+ throw new Error('values less than -1 are not allowed');
147
166
  }
148
167
  this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;
149
- this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;
168
+ this.params[this.length++] = value > Constants.MAX_VALUE ? Constants.MAX_VALUE : value;
150
169
  }
151
170
 
152
171
  /**
153
172
  * Add a sub parameter value.
154
173
  * The sub parameter is automatically associated with the last parameter value.
155
174
  * Thus it is not possible to add a subparameter without any parameter added yet.
156
- * `Params` only stores up to `subParamsLength` sub parameters, any later
175
+ * `Params` only stores up to `maxSubParamsLength` sub parameters, any later
157
176
  * sub parameter will be ignored.
158
177
  */
159
178
  public addSubParam(value: number): void {
@@ -166,9 +185,9 @@ export class Params implements IParams {
166
185
  return;
167
186
  }
168
187
  if (value < -1) {
169
- throw new Error('values lesser than -1 are not allowed');
188
+ throw new Error('values less than -1 are not allowed');
170
189
  }
171
- this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;
190
+ this._subParams[this._subParamsLength++] = value > Constants.MAX_VALUE ? Constants.MAX_VALUE : value;
172
191
  this._subParamsIdx[this.length - 1]++;
173
192
  }
174
193
 
@@ -224,6 +243,6 @@ export class Params implements IParams {
224
243
 
225
244
  const store = this._digitIsSub ? this._subParams : this.params;
226
245
  const cur = store[length - 1];
227
- 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;
228
247
  }
229
248
  }
@@ -3,12 +3,10 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IDisposable } from 'common/Types';
7
- import { ParserState } from 'common/parser/Constants';
6
+ import { IDisposable, IParams, ParamsArray } from '../Types';
7
+ import { ParserState } from './Constants';
8
8
 
9
-
10
- /** sequence params serialized to js arrays */
11
- export type ParamsArray = (number | number[])[];
9
+ export type { IParams, ParamsArray };
12
10
 
13
11
  /** Params constructor type. */
14
12
  export interface IParamsConstructor {
@@ -18,27 +16,6 @@ export interface IParamsConstructor {
18
16
  fromArray(values: ParamsArray): IParams;
19
17
  }
20
18
 
21
- /** Interface of Params storage class. */
22
- export interface IParams {
23
- /** from ctor */
24
- maxLength: number;
25
- maxSubParamsLength: number;
26
-
27
- /** param values and its length */
28
- params: Int32Array;
29
- length: number;
30
-
31
- /** methods */
32
- clone(): IParams;
33
- toArray(): ParamsArray;
34
- reset(): void;
35
- addParam(value: number): void;
36
- addSubParam(value: number): void;
37
- hasSubParams(idx: number): boolean;
38
- getSubParams(idx: number): Int32Array | null;
39
- getSubParamsAll(): {[idx: number]: Int32Array};
40
- }
41
-
42
19
  /**
43
20
  * Internal state of EscapeSequenceParser.
44
21
  * Used as argument of the error handler to allow
@@ -107,7 +84,7 @@ export type EscFallbackHandlerType = (identifier: number) => void;
107
84
  /**
108
85
  * EXECUTE handler types.
109
86
  */
110
- export type ExecuteHandlerType = () => boolean;
87
+ export type ExecuteHandlerType = (ident?: number) => boolean;
111
88
  export type ExecuteFallbackHandlerType = (ident: number) => void;
112
89
 
113
90
  /**
@@ -134,6 +111,29 @@ export interface IOscHandler {
134
111
  }
135
112
  export type OscFallbackHandlerType = (ident: number, action: 'START' | 'PUT' | 'END', payload?: any) => void;
136
113
 
114
+ /**
115
+ * APC handler types.
116
+ */
117
+ export interface IApcHandler {
118
+ /**
119
+ * Announces start of this APC command.
120
+ * Prepare needed data structures here.
121
+ */
122
+ start(): void;
123
+ /**
124
+ * Incoming data chunk.
125
+ */
126
+ put(data: Uint32Array, start: number, end: number): void;
127
+ /**
128
+ * End of APC command. `success` indicates whether the
129
+ * command finished normally or got aborted, thus final
130
+ * execution of the command should depend on `success`.
131
+ * To save memory also cleanup data structures here.
132
+ */
133
+ end(success: boolean): boolean | Promise<boolean>;
134
+ }
135
+ export type ApcFallbackHandlerType = (ident: number, action: 'START' | 'PUT' | 'END', payload?: any) => void;
136
+
137
137
  /**
138
138
  * PRINT handler types.
139
139
  */
@@ -196,6 +196,10 @@ export interface IEscapeSequenceParser extends IDisposable {
196
196
  clearOscHandler(ident: number): void;
197
197
  setOscHandlerFallback(handler: OscFallbackHandlerType): void;
198
198
 
199
+ registerApcHandler(id: IFunctionIdentifier, handler: IApcHandler): IDisposable;
200
+ clearApcHandler(id: IFunctionIdentifier): void;
201
+ setApcHandlerFallback(handler: ApcFallbackHandlerType): void;
202
+
199
203
  setErrorHandler(handler: (state: IParsingState) => IParsingState): void;
200
204
  clearErrorHandler(): void;
201
205
  }
@@ -223,10 +227,15 @@ export interface IDcsParser extends ISubParser<IDcsHandler, DcsFallbackHandlerTy
223
227
  unhook(success: boolean, promiseResult?: boolean): void | Promise<boolean>;
224
228
  }
225
229
 
230
+ export interface IApcParser extends ISubParser<IApcHandler, ApcFallbackHandlerType> {
231
+ start(ident: number): void;
232
+ end(success: boolean, promiseResult?: boolean): void | Promise<boolean>;
233
+ }
234
+
226
235
  /**
227
236
  * Interface to denote a specific ESC, CSI or DCS handler slot.
228
- * The values are used to create an integer respresentation during handler
229
- * regristation before passed to the subparsers as `ident`.
237
+ * The values are used to create an integer representation during handler
238
+ * registration before passed to the subparsers as `ident`.
230
239
  * The integer translation is made to allow a faster handler access
231
240
  * in `EscapeSequenceParser.parse`.
232
241
  */
@@ -252,7 +261,8 @@ export const enum ParserStackType {
252
261
  CSI,
253
262
  ESC,
254
263
  OSC,
255
- DCS
264
+ DCS,
265
+ APC
256
266
  }
257
267
 
258
268
  // aggregate of resumable handler lists
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';
7
- import { IBuffer } from 'common/buffer/Types';
8
- import { BufferLineApiView } from 'common/public/BufferLineApiView';
9
- import { CellData } from 'common/buffer/CellData';
7
+ import { IBuffer } from '../buffer/Types';
8
+ import { BufferLineApiView } from './BufferLineApiView';
9
+ import { CellData } from '../buffer/CellData';
10
10
 
11
11
  export class BufferApiView implements IBufferApi {
12
12
  constructor(
@@ -3,8 +3,8 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { CellData } from 'common/buffer/CellData';
7
- import { IBufferLine, ICellData } from 'common/Types';
6
+ import { CellData } from '../buffer/CellData';
7
+ import { IBufferLine, ICellData } from '../buffer/Types';
8
8
  import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
9
9
 
10
10
  export class BufferLineApiView implements IBufferLineApi {
@@ -18,10 +18,10 @@ export class BufferLineApiView implements IBufferLineApi {
18
18
  }
19
19
 
20
20
  if (cell) {
21
- this._line.loadCell(x, cell as ICellData);
21
+ this._line.loadCell(x, cell as unknown as ICellData);
22
22
  return cell;
23
23
  }
24
- return this._line.loadCell(x, new CellData());
24
+ return this._line.loadCell(x, new CellData()) as unknown as IBufferCellApi;
25
25
  }
26
26
  public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {
27
27
  return this._line.translateToString(trimRight, startColumn, endColumn);
@@ -4,10 +4,10 @@
4
4
  */
5
5
 
6
6
  import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
7
- import { BufferApiView } from 'common/public/BufferApiView';
8
- import { ICoreTerminal } from 'common/Types';
9
- import { Disposable } from 'vs/base/common/lifecycle';
10
- import { Emitter } from 'vs/base/common/event';
7
+ import { BufferApiView } from './BufferApiView';
8
+ import { ICoreTerminal } from '../CoreTerminal';
9
+ import { Disposable } from '../Lifecycle';
10
+ import { Emitter } from '../Event';
11
11
 
12
12
  export class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {
13
13
  private _normal: BufferApiView;
@@ -20,7 +20,7 @@ export class BufferNamespaceApi extends Disposable implements IBufferNamespaceAp
20
20
  super();
21
21
  this._normal = new BufferApiView(this._core.buffers.normal, 'normal');
22
22
  this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');
23
- this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));
23
+ this._register(this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active)));
24
24
  }
25
25
  public get active(): IBufferApi {
26
26
  if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IParams } from 'common/parser/Types';
6
+ import { IParams } from '../parser/Types';
7
7
  import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
8
- import { ICoreTerminal } from 'common/Types';
8
+ import { ICoreTerminal } from '../CoreTerminal';
9
9
 
10
10
  export class ParserApi implements IParser {
11
11
  constructor(private _core: ICoreTerminal) { }
@@ -34,4 +34,7 @@ export class ParserApi implements IParser {
34
34
  public addOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable {
35
35
  return this.registerOscHandler(ident, callback);
36
36
  }
37
+ public registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable {
38
+ return this._core.registerApcHandler(id, callback);
39
+ }
37
40
  }
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { ICoreTerminal } from 'common/Types';
6
+ import { ICoreTerminal } from '../CoreTerminal';
7
7
  import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
8
8
 
9
9
  export class UnicodeApi implements IUnicodeHandling {
@@ -3,15 +3,16 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { Disposable } from 'vs/base/common/lifecycle';
7
- import { IAttributeData, IBufferLine } from 'common/Types';
8
- import { BufferSet } from 'common/buffer/BufferSet';
9
- import { IBuffer, IBufferSet } from 'common/buffer/Types';
10
- import { IBufferService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';
11
- import { Emitter } from 'vs/base/common/event';
12
-
13
- export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
14
- export const MINIMUM_ROWS = 1;
6
+ import { Disposable } from '../Lifecycle';
7
+ import { IAttributeData, IBuffer, IBufferLine, IBufferSet } from '../buffer/Types';
8
+ import { BufferSet } from '../buffer/BufferSet';
9
+ import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
10
+ import { Emitter } from '../Event';
11
+
12
+ export const enum BufferServiceConstants {
13
+ MINIMUM_COLS = 2, // Less than 2 can mess with wide chars
14
+ MINIMUM_ROWS = 1
15
+ }
15
16
 
16
17
  export class BufferService extends Disposable implements IBufferService {
17
18
  public serviceBrand: any;
@@ -32,11 +33,14 @@ export class BufferService extends Disposable implements IBufferService {
32
33
  /** An IBufferline to clone/copy from for new blank lines */
33
34
  private _cachedBlankLine: IBufferLine | undefined;
34
35
 
35
- constructor(@IOptionsService optionsService: IOptionsService) {
36
+ constructor(
37
+ @IOptionsService optionsService: IOptionsService,
38
+ @ILogService logService: ILogService
39
+ ) {
36
40
  super();
37
- this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);
38
- this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);
39
- this.buffers = this._register(new BufferSet(optionsService, this));
41
+ this.cols = Math.max(optionsService.rawOptions.cols || 0, BufferServiceConstants.MINIMUM_COLS);
42
+ this.rows = Math.max(optionsService.rawOptions.rows || 0, BufferServiceConstants.MINIMUM_ROWS);
43
+ this.buffers = this._register(new BufferSet(optionsService, this, logService));
40
44
  this._register(this.buffers.onBufferActivate(e => {
41
45
  this._onScroll.fire(e.activeBuffer.ydisp);
42
46
  }));
@@ -3,8 +3,8 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { ICharsetService } from 'common/services/Services';
7
- import { ICharset } from 'common/Types';
6
+ import { ICharsetService } from './Services';
7
+ import { ICharset } from '../Types';
8
8
 
9
9
  export class CharsetService implements ICharsetService {
10
10
  public serviceBrand: any;
@@ -14,6 +14,10 @@ export class CharsetService implements ICharsetService {
14
14
 
15
15
  private _charsets: (ICharset | undefined)[] = [];
16
16
 
17
+ public get charsets(): (ICharset | undefined)[] {
18
+ return this._charsets;
19
+ }
20
+
17
21
  public reset(): void {
18
22
  this.charset = undefined;
19
23
  this._charsets = [];
@@ -3,11 +3,10 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { clone } from 'common/Clone';
7
- import { Disposable } from 'vs/base/common/lifecycle';
8
- import { IDecPrivateModes, IModes } from 'common/Types';
9
- import { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';
10
- import { Emitter } from 'vs/base/common/event';
6
+ import { Disposable } from '../Lifecycle';
7
+ import { IDecPrivateModes, IKittyKeyboardState, IModes } from '../Types';
8
+ import { IBufferService, ICoreService, ILogService, IOptionsService } from './Services';
9
+ import { Emitter } from '../Event';
11
10
 
12
11
  const DEFAULT_MODES: IModes = Object.freeze({
13
12
  insertMode: false
@@ -17,22 +16,33 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
17
16
  applicationCursorKeys: false,
18
17
  applicationKeypad: false,
19
18
  bracketedPasteMode: false,
19
+ colorSchemeUpdates: false,
20
20
  cursorBlink: undefined,
21
21
  cursorStyle: undefined,
22
22
  origin: false,
23
23
  reverseWraparound: false,
24
24
  sendFocus: false,
25
25
  synchronizedOutput: false,
26
+ win32InputMode: false,
26
27
  wraparound: true // defaults: xterm - true, vt100 - false
27
28
  });
28
29
 
30
+ const DEFAULT_KITTY_KEYBOARD_STATE = (): IKittyKeyboardState => ({
31
+ flags: 0,
32
+ mainFlags: 0,
33
+ altFlags: 0,
34
+ mainStack: [],
35
+ altStack: []
36
+ });
37
+
29
38
  export class CoreService extends Disposable implements ICoreService {
30
39
  public serviceBrand: any;
31
40
 
32
- public isCursorInitialized: boolean = false;
41
+ public isCursorInitialized: boolean;
33
42
  public isCursorHidden: boolean = false;
34
43
  public modes: IModes;
35
44
  public decPrivateModes: IDecPrivateModes;
45
+ public kittyKeyboard: IKittyKeyboardState;
36
46
 
37
47
  private readonly _onData = this._register(new Emitter<string>());
38
48
  public readonly onData = this._onData.event;
@@ -49,13 +59,16 @@ export class CoreService extends Disposable implements ICoreService {
49
59
  @IOptionsService private readonly _optionsService: IOptionsService
50
60
  ) {
51
61
  super();
52
- this.modes = clone(DEFAULT_MODES);
53
- this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);
62
+ this.isCursorInitialized = _optionsService.rawOptions.showCursorImmediately ?? false;
63
+ this.modes = structuredClone(DEFAULT_MODES);
64
+ this.decPrivateModes = structuredClone(DEFAULT_DEC_PRIVATE_MODES);
65
+ this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();
54
66
  }
55
67
 
56
68
  public reset(): void {
57
- this.modes = clone(DEFAULT_MODES);
58
- this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);
69
+ this.modes = structuredClone(DEFAULT_MODES);
70
+ this.decPrivateModes = structuredClone(DEFAULT_DEC_PRIVATE_MODES);
71
+ this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();
59
72
  }
60
73
 
61
74
  public triggerDataEvent(data: string, wasUserInput: boolean = false): void {