@xterm/xterm 6.1.0-beta.26 → 6.1.0-beta.261

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 (179) 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 -48
  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 +177 -346
  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 +4 -4
  16. package/src/browser/TimeBasedDebouncer.ts +3 -3
  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/MoveToCell.ts +2 -2
  24. package/src/browser/public/Terminal.ts +33 -36
  25. package/src/browser/renderer/dom/DomRenderer.ts +251 -85
  26. package/src/browser/renderer/dom/DomRendererRowFactory.ts +34 -27
  27. package/src/browser/renderer/dom/WidthCache.ts +57 -55
  28. package/src/browser/renderer/shared/Constants.ts +7 -0
  29. package/src/browser/renderer/shared/RendererUtils.ts +1 -1
  30. package/src/browser/renderer/shared/SelectionRenderModel.ts +2 -2
  31. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  32. package/src/browser/renderer/shared/Types.ts +10 -4
  33. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  34. package/src/browser/scrollable/fastDomNode.ts +126 -0
  35. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  36. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  37. package/src/browser/scrollable/mouseEvent.ts +292 -0
  38. package/src/browser/scrollable/scrollable.ts +486 -0
  39. package/src/browser/scrollable/scrollableElement.ts +581 -0
  40. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  41. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  42. package/src/browser/scrollable/scrollbarState.ts +246 -0
  43. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  44. package/src/browser/scrollable/touch.ts +485 -0
  45. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  46. package/src/browser/scrollable/widget.ts +23 -0
  47. package/src/browser/selection/SelectionModel.ts +1 -1
  48. package/src/browser/services/CharSizeService.ts +4 -4
  49. package/src/browser/services/CharacterJoinerService.ts +7 -7
  50. package/src/browser/services/CoreBrowserService.ts +7 -5
  51. package/src/browser/services/KeyboardService.ts +67 -0
  52. package/src/browser/services/LinkProviderService.ts +3 -3
  53. package/src/browser/services/MouseCoordsService.ts +47 -0
  54. package/src/browser/services/MouseService.ts +619 -23
  55. package/src/browser/services/RenderService.ts +33 -21
  56. package/src/browser/services/SelectionService.ts +72 -54
  57. package/src/browser/services/Services.ts +44 -21
  58. package/src/browser/services/ThemeService.ts +8 -8
  59. package/src/common/Async.ts +141 -0
  60. package/src/common/CircularList.ts +24 -3
  61. package/src/common/Color.ts +9 -1
  62. package/src/common/CoreTerminal.ts +61 -35
  63. package/src/common/Event.ts +118 -0
  64. package/src/common/InputHandler.ts +301 -102
  65. package/src/common/Lifecycle.ts +113 -0
  66. package/src/common/Platform.ts +13 -3
  67. package/src/common/SortedList.ts +8 -4
  68. package/src/common/StringBuilder.ts +67 -0
  69. package/src/common/TaskQueue.ts +16 -7
  70. package/src/common/Types.ts +67 -205
  71. package/src/common/Version.ts +9 -0
  72. package/src/common/WindowsMode.ts +2 -2
  73. package/src/common/buffer/AttributeData.ts +3 -2
  74. package/src/common/buffer/Buffer.ts +45 -30
  75. package/src/common/buffer/BufferLine.ts +145 -73
  76. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  77. package/src/common/buffer/BufferReflow.ts +7 -4
  78. package/src/common/buffer/BufferSet.ts +13 -9
  79. package/src/common/buffer/CellData.ts +61 -4
  80. package/src/common/buffer/Marker.ts +3 -3
  81. package/src/common/buffer/Types.ts +153 -3
  82. package/src/common/data/Charsets.ts +4 -7
  83. package/src/common/data/EscapeSequences.ts +71 -70
  84. package/src/common/input/Keyboard.ts +16 -9
  85. package/src/common/input/KittyKeyboard.ts +526 -0
  86. package/src/common/input/TextDecoder.ts +1 -1
  87. package/src/common/input/UnicodeV6.ts +3 -2
  88. package/src/common/input/Win32InputMode.ts +297 -0
  89. package/src/common/input/WriteBuffer.ts +107 -38
  90. package/src/common/input/XParseColor.ts +2 -2
  91. package/src/common/parser/ApcParser.ts +196 -0
  92. package/src/common/parser/Constants.ts +14 -4
  93. package/src/common/parser/DcsParser.ts +15 -16
  94. package/src/common/parser/EscapeSequenceParser.ts +212 -70
  95. package/src/common/parser/OscParser.ts +14 -15
  96. package/src/common/parser/Params.ts +28 -9
  97. package/src/common/parser/Types.ts +38 -28
  98. package/src/common/public/BufferApiView.ts +3 -3
  99. package/src/common/public/BufferLineApiView.ts +4 -4
  100. package/src/common/public/BufferNamespaceApi.ts +5 -5
  101. package/src/common/public/ParserApi.ts +5 -2
  102. package/src/common/public/UnicodeApi.ts +1 -1
  103. package/src/common/services/BufferService.ts +17 -13
  104. package/src/common/services/CharsetService.ts +6 -2
  105. package/src/common/services/CoreService.ts +23 -10
  106. package/src/common/services/DecorationService.ts +260 -15
  107. package/src/common/services/InstantiationService.ts +2 -2
  108. package/src/common/services/LogService.ts +2 -32
  109. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +22 -133
  110. package/src/common/services/OptionsService.ts +17 -7
  111. package/src/common/services/OscLinkService.ts +3 -2
  112. package/src/common/services/ServiceRegistry.ts +14 -8
  113. package/src/common/services/Services.ts +52 -48
  114. package/src/common/services/UnicodeService.ts +6 -11
  115. package/typings/xterm.d.ts +329 -34
  116. package/src/common/Clone.ts +0 -23
  117. package/src/common/TypedArrayUtils.ts +0 -17
  118. package/src/vs/base/browser/browser.ts +0 -141
  119. package/src/vs/base/browser/canIUse.ts +0 -49
  120. package/src/vs/base/browser/dom.ts +0 -2369
  121. package/src/vs/base/browser/fastDomNode.ts +0 -316
  122. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  123. package/src/vs/base/browser/iframe.ts +0 -135
  124. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  125. package/src/vs/base/browser/mouseEvent.ts +0 -229
  126. package/src/vs/base/browser/touch.ts +0 -372
  127. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  128. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  129. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  130. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  131. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  132. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  133. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  134. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  135. package/src/vs/base/browser/ui/widget.ts +0 -57
  136. package/src/vs/base/browser/window.ts +0 -14
  137. package/src/vs/base/common/arrays.ts +0 -887
  138. package/src/vs/base/common/arraysFind.ts +0 -202
  139. package/src/vs/base/common/assert.ts +0 -71
  140. package/src/vs/base/common/async.ts +0 -1992
  141. package/src/vs/base/common/cancellation.ts +0 -148
  142. package/src/vs/base/common/charCode.ts +0 -450
  143. package/src/vs/base/common/collections.ts +0 -140
  144. package/src/vs/base/common/decorators.ts +0 -130
  145. package/src/vs/base/common/equals.ts +0 -146
  146. package/src/vs/base/common/errors.ts +0 -303
  147. package/src/vs/base/common/event.ts +0 -1778
  148. package/src/vs/base/common/functional.ts +0 -32
  149. package/src/vs/base/common/hash.ts +0 -316
  150. package/src/vs/base/common/iterator.ts +0 -159
  151. package/src/vs/base/common/keyCodes.ts +0 -526
  152. package/src/vs/base/common/keybindings.ts +0 -284
  153. package/src/vs/base/common/lazy.ts +0 -47
  154. package/src/vs/base/common/lifecycle.ts +0 -801
  155. package/src/vs/base/common/linkedList.ts +0 -142
  156. package/src/vs/base/common/map.ts +0 -202
  157. package/src/vs/base/common/numbers.ts +0 -98
  158. package/src/vs/base/common/observable.ts +0 -76
  159. package/src/vs/base/common/observableInternal/api.ts +0 -31
  160. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  161. package/src/vs/base/common/observableInternal/base.ts +0 -489
  162. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  163. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  164. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  165. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  166. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  167. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  168. package/src/vs/base/common/platform.ts +0 -281
  169. package/src/vs/base/common/scrollable.ts +0 -522
  170. package/src/vs/base/common/sequence.ts +0 -34
  171. package/src/vs/base/common/stopwatch.ts +0 -43
  172. package/src/vs/base/common/strings.ts +0 -557
  173. package/src/vs/base/common/symbols.ts +0 -9
  174. package/src/vs/base/common/uint.ts +0 -59
  175. package/src/vs/patches/nls.ts +0 -90
  176. package/src/vs/typings/base-common.d.ts +0 -20
  177. package/src/vs/typings/require.d.ts +0 -42
  178. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  179. package/src/vs/typings/vscode-globals-product.d.ts +0 -33
@@ -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,6 +227,11 @@ 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
237
  * The values are used to create an integer respresentation during handler
@@ -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 {