@xterm/xterm 6.1.0-beta.25 → 6.1.0-beta.251

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 (163) 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 +25 -22
  8. package/src/browser/AccessibilityManager.ts +11 -6
  9. package/src/browser/Clipboard.ts +6 -3
  10. package/src/browser/CoreBrowserTerminal.ts +149 -319
  11. package/src/browser/Dom.ts +178 -0
  12. package/src/browser/Linkifier.ts +11 -11
  13. package/src/browser/OscLinkProvider.ts +82 -14
  14. package/src/browser/RenderDebouncer.ts +2 -2
  15. package/src/browser/TimeBasedDebouncer.ts +2 -2
  16. package/src/browser/Types.ts +12 -11
  17. package/src/browser/Viewport.ts +55 -20
  18. package/src/browser/decorations/BufferDecorationRenderer.ts +1 -1
  19. package/src/browser/decorations/OverviewRulerRenderer.ts +33 -17
  20. package/src/browser/input/CompositionHelper.ts +44 -8
  21. package/src/browser/public/Terminal.ts +25 -28
  22. package/src/browser/renderer/dom/DomRenderer.ts +242 -76
  23. package/src/browser/renderer/dom/DomRendererRowFactory.ts +19 -13
  24. package/src/browser/renderer/dom/WidthCache.ts +54 -52
  25. package/src/browser/renderer/shared/Constants.ts +7 -0
  26. package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
  27. package/src/browser/renderer/shared/Types.ts +8 -2
  28. package/src/browser/scrollable/abstractScrollbar.ts +300 -0
  29. package/src/browser/scrollable/fastDomNode.ts +126 -0
  30. package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
  31. package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
  32. package/src/browser/scrollable/mouseEvent.ts +292 -0
  33. package/src/browser/scrollable/scrollable.ts +486 -0
  34. package/src/browser/scrollable/scrollableElement.ts +581 -0
  35. package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
  36. package/src/browser/scrollable/scrollbarArrow.ts +110 -0
  37. package/src/browser/scrollable/scrollbarState.ts +246 -0
  38. package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
  39. package/src/browser/scrollable/touch.ts +485 -0
  40. package/src/browser/scrollable/verticalScrollbar.ts +143 -0
  41. package/src/browser/scrollable/widget.ts +23 -0
  42. package/src/browser/services/CharSizeService.ts +2 -2
  43. package/src/browser/services/CoreBrowserService.ts +7 -5
  44. package/src/browser/services/KeyboardService.ts +67 -0
  45. package/src/browser/services/LinkProviderService.ts +1 -1
  46. package/src/browser/services/MouseCoordsService.ts +47 -0
  47. package/src/browser/services/MouseService.ts +518 -25
  48. package/src/browser/services/RenderService.ts +28 -16
  49. package/src/browser/services/SelectionService.ts +45 -39
  50. package/src/browser/services/Services.ts +40 -17
  51. package/src/browser/services/ThemeService.ts +2 -2
  52. package/src/common/Async.ts +141 -0
  53. package/src/common/CircularList.ts +2 -2
  54. package/src/common/Color.ts +8 -0
  55. package/src/common/CoreTerminal.ts +32 -22
  56. package/src/common/Event.ts +118 -0
  57. package/src/common/InputHandler.ts +286 -87
  58. package/src/common/Lifecycle.ts +113 -0
  59. package/src/common/Platform.ts +13 -3
  60. package/src/common/SortedList.ts +7 -3
  61. package/src/common/StringBuilder.ts +67 -0
  62. package/src/common/TaskQueue.ts +14 -5
  63. package/src/common/Types.ts +51 -31
  64. package/src/common/Version.ts +9 -0
  65. package/src/common/buffer/Buffer.ts +34 -19
  66. package/src/common/buffer/BufferLine.ts +140 -68
  67. package/src/common/buffer/BufferLineStringCache.ts +69 -0
  68. package/src/common/buffer/BufferReflow.ts +4 -1
  69. package/src/common/buffer/BufferSet.ts +11 -6
  70. package/src/common/buffer/CellData.ts +57 -0
  71. package/src/common/buffer/Marker.ts +2 -2
  72. package/src/common/buffer/Types.ts +6 -2
  73. package/src/common/data/EscapeSequences.ts +71 -70
  74. package/src/common/input/Keyboard.ts +14 -7
  75. package/src/common/input/KittyKeyboard.ts +526 -0
  76. package/src/common/input/Win32InputMode.ts +297 -0
  77. package/src/common/input/WriteBuffer.ts +107 -38
  78. package/src/common/input/XParseColor.ts +2 -2
  79. package/src/common/parser/ApcParser.ts +196 -0
  80. package/src/common/parser/Constants.ts +14 -4
  81. package/src/common/parser/DcsParser.ts +11 -12
  82. package/src/common/parser/EscapeSequenceParser.ts +205 -63
  83. package/src/common/parser/OscParser.ts +11 -12
  84. package/src/common/parser/Params.ts +27 -8
  85. package/src/common/parser/Types.ts +36 -2
  86. package/src/common/public/BufferLineApiView.ts +2 -2
  87. package/src/common/public/BufferNamespaceApi.ts +3 -3
  88. package/src/common/public/ParserApi.ts +3 -0
  89. package/src/common/services/BufferService.ts +14 -9
  90. package/src/common/services/CharsetService.ts +4 -0
  91. package/src/common/services/CoreService.ts +22 -9
  92. package/src/common/services/DecorationService.ts +255 -8
  93. package/src/common/services/LogService.ts +1 -31
  94. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +21 -132
  95. package/src/common/services/OptionsService.ts +13 -4
  96. package/src/common/services/ServiceRegistry.ts +9 -7
  97. package/src/common/services/Services.ts +49 -40
  98. package/src/common/services/UnicodeService.ts +1 -1
  99. package/typings/xterm.d.ts +318 -34
  100. package/src/common/Clone.ts +0 -23
  101. package/src/common/TypedArrayUtils.ts +0 -17
  102. package/src/vs/base/browser/browser.ts +0 -141
  103. package/src/vs/base/browser/canIUse.ts +0 -49
  104. package/src/vs/base/browser/dom.ts +0 -2369
  105. package/src/vs/base/browser/fastDomNode.ts +0 -316
  106. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  107. package/src/vs/base/browser/iframe.ts +0 -135
  108. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  109. package/src/vs/base/browser/mouseEvent.ts +0 -229
  110. package/src/vs/base/browser/touch.ts +0 -372
  111. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  112. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  113. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  114. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  115. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  116. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  117. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  118. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  119. package/src/vs/base/browser/ui/widget.ts +0 -57
  120. package/src/vs/base/browser/window.ts +0 -14
  121. package/src/vs/base/common/arrays.ts +0 -887
  122. package/src/vs/base/common/arraysFind.ts +0 -202
  123. package/src/vs/base/common/assert.ts +0 -71
  124. package/src/vs/base/common/async.ts +0 -1992
  125. package/src/vs/base/common/cancellation.ts +0 -148
  126. package/src/vs/base/common/charCode.ts +0 -450
  127. package/src/vs/base/common/collections.ts +0 -140
  128. package/src/vs/base/common/decorators.ts +0 -130
  129. package/src/vs/base/common/equals.ts +0 -146
  130. package/src/vs/base/common/errors.ts +0 -303
  131. package/src/vs/base/common/event.ts +0 -1778
  132. package/src/vs/base/common/functional.ts +0 -32
  133. package/src/vs/base/common/hash.ts +0 -316
  134. package/src/vs/base/common/iterator.ts +0 -159
  135. package/src/vs/base/common/keyCodes.ts +0 -526
  136. package/src/vs/base/common/keybindings.ts +0 -284
  137. package/src/vs/base/common/lazy.ts +0 -47
  138. package/src/vs/base/common/lifecycle.ts +0 -801
  139. package/src/vs/base/common/linkedList.ts +0 -142
  140. package/src/vs/base/common/map.ts +0 -202
  141. package/src/vs/base/common/numbers.ts +0 -98
  142. package/src/vs/base/common/observable.ts +0 -76
  143. package/src/vs/base/common/observableInternal/api.ts +0 -31
  144. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  145. package/src/vs/base/common/observableInternal/base.ts +0 -489
  146. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  147. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  148. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  149. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  150. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  151. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  152. package/src/vs/base/common/platform.ts +0 -281
  153. package/src/vs/base/common/scrollable.ts +0 -522
  154. package/src/vs/base/common/sequence.ts +0 -34
  155. package/src/vs/base/common/stopwatch.ts +0 -43
  156. package/src/vs/base/common/strings.ts +0 -557
  157. package/src/vs/base/common/symbols.ts +0 -9
  158. package/src/vs/base/common/uint.ts +0 -59
  159. package/src/vs/patches/nls.ts +0 -90
  160. package/src/vs/typings/base-common.d.ts +0 -20
  161. package/src/vs/typings/require.d.ts +0 -42
  162. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  163. package/src/vs/typings/vscode-globals-product.d.ts +0 -33
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';
7
7
  import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
8
- import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
8
+ import { Disposable, toDisposable } from 'common/Lifecycle';
9
9
  import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
10
10
 
11
11
  const enum Constants {
@@ -38,7 +38,12 @@ export class OverviewRulerRenderer extends Disposable {
38
38
  private readonly _ctx: CanvasRenderingContext2D;
39
39
  private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();
40
40
  private get _width(): number {
41
- return this._optionsService.options.overviewRuler?.width || 0;
41
+ const scrollbar = this._optionsService.rawOptions.scrollbar;
42
+ const showScrollbar = scrollbar?.showScrollbar ?? true;
43
+ if (!showScrollbar) {
44
+ return 0;
45
+ }
46
+ return scrollbar?.width ?? 0;
42
47
  }
43
48
  private _animationFrame: number | undefined;
44
49
 
@@ -46,8 +51,6 @@ export class OverviewRulerRenderer extends Disposable {
46
51
  private _shouldUpdateAnchor: boolean | undefined = true;
47
52
  private _lastKnownBufferLength: number = 0;
48
53
 
49
- private _containerHeight: number | undefined;
50
-
51
54
  constructor(
52
55
  private readonly _viewportElement: HTMLElement,
53
56
  private readonly _screenElement: HTMLElement,
@@ -86,17 +89,17 @@ export class OverviewRulerRenderer extends Disposable {
86
89
  }
87
90
  }));
88
91
 
89
- // Container height changed
90
- this._register(this._renderService.onRender((): void => {
91
- if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {
92
- this._queueRefresh(true);
93
- this._containerHeight = this._screenElement.clientHeight;
94
- }
95
- }));
92
+ this._register(this._renderService.onDimensionsChange(() => this._queueRefresh(true)));
96
93
 
97
94
  this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
98
- this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));
95
+ this._register(this._optionsService.onSpecificOptionChange('scrollbar', () => this._queueRefresh(true)));
99
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
+ }));
100
103
  this._queueRefresh(true);
101
104
  }
102
105
 
@@ -139,15 +142,23 @@ export class OverviewRulerRenderer extends Disposable {
139
142
  }
140
143
 
141
144
  private _refreshCanvasDimensions(): void {
145
+ if (this._store.isDisposed || !this._renderService.hasRenderer()) {
146
+ return;
147
+ }
148
+ const cssCanvasHeight = this._renderService.dimensions.css.canvas.height;
149
+ const deviceCanvasHeight = this._renderService.dimensions.device.canvas.height;
142
150
  this._canvas.style.width = `${this._width}px`;
143
151
  this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);
144
- this._canvas.style.height = `${this._screenElement.clientHeight}px`;
145
- this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);
152
+ this._canvas.style.height = `${cssCanvasHeight}px`;
153
+ this._canvas.height = deviceCanvasHeight;
146
154
  this._refreshDrawConstants();
147
155
  this._refreshColorZonePadding();
148
156
  }
149
157
 
150
158
  private _refreshDecorations(): void {
159
+ if (this._store.isDisposed || !this._renderService.hasRenderer()) {
160
+ return;
161
+ }
151
162
  if (this._shouldUpdateDimensions) {
152
163
  this._refreshCanvasDimensions();
153
164
  }
@@ -176,10 +187,10 @@ export class OverviewRulerRenderer extends Disposable {
176
187
  private _renderRulerOutline(): void {
177
188
  this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;
178
189
  this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
179
- if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {
190
+ if (this._optionsService.rawOptions.scrollbar?.overviewRuler?.showTopBorder) {
180
191
  this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);
181
192
  }
182
- if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {
193
+ if (this._optionsService.rawOptions.scrollbar?.overviewRuler?.showBottomBorder) {
183
194
  this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
184
195
  }
185
196
  }
@@ -201,13 +212,18 @@ export class OverviewRulerRenderer extends Disposable {
201
212
  }
202
213
 
203
214
  private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {
215
+ if (this._store.isDisposed) {
216
+ return;
217
+ }
204
218
  this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;
205
219
  this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;
206
220
  if (this._animationFrame !== undefined) {
207
221
  return;
208
222
  }
209
223
  this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
210
- this._refreshDecorations();
224
+ if (!this._store.isDisposed) {
225
+ this._refreshDecorations();
226
+ }
211
227
  this._animationFrame = undefined;
212
228
  });
213
229
  }
@@ -30,6 +30,12 @@ export class CompositionHelper {
30
30
  */
31
31
  private _compositionPosition: IPosition;
32
32
 
33
+ /**
34
+ * Text that existed after the composing range when composition started.
35
+ * This is used to avoid treating existing trailing text as new input.
36
+ */
37
+ private _compositionSuffix: string;
38
+
33
39
  /**
34
40
  * Whether a composition is in the process of being sent, setting this to false will cancel any
35
41
  * in-progress composition.
@@ -41,6 +47,11 @@ export class CompositionHelper {
41
47
  */
42
48
  private _dataAlreadySent: string;
43
49
 
50
+ /**
51
+ * The pending textarea change timer, if any.
52
+ */
53
+ private _textareaChangeTimer?: number;
54
+
44
55
  constructor(
45
56
  private readonly _textarea: HTMLTextAreaElement,
46
57
  private readonly _compositionView: HTMLElement,
@@ -52,6 +63,7 @@ export class CompositionHelper {
52
63
  this._isComposing = false;
53
64
  this._isSendingComposition = false;
54
65
  this._compositionPosition = { start: 0, end: 0 };
66
+ this._compositionSuffix = '';
55
67
  this._dataAlreadySent = '';
56
68
  }
57
69
 
@@ -60,7 +72,13 @@ export class CompositionHelper {
60
72
  */
61
73
  public compositionstart(): void {
62
74
  this._isComposing = true;
63
- this._compositionPosition.start = this._textarea.value.length;
75
+ // It's important to use the selection here instead of textarea length to avoid conflicts with
76
+ // screen reader mode
77
+ const start = this._textarea.selectionStart ?? this._textarea.value.length;
78
+ const end = this._textarea.selectionEnd ?? start;
79
+ this._compositionPosition.start = Math.min(start, end);
80
+ this._compositionPosition.end = Math.max(start, end);
81
+ this._compositionSuffix = this._textarea.value.substring(this._compositionPosition.end);
64
82
  this._compositionView.textContent = '';
65
83
  this._dataAlreadySent = '';
66
84
  this._compositionView.classList.add('active');
@@ -71,10 +89,13 @@ export class CompositionHelper {
71
89
  * @param ev The event.
72
90
  */
73
91
  public compositionupdate(ev: Pick<CompositionEvent, 'data'>): void {
74
- this._compositionView.textContent = ev.data;
92
+ // Mark text as LTR, direction=rtl is used in CSS so the end of the text is followed for long
93
+ // compositions
94
+ this._compositionView.textContent = `\u200E${ev.data}\u200E`;
75
95
  this.updateCompositionElements();
76
96
  setTimeout(() => {
77
- this._compositionPosition.end = this._textarea.value.length;
97
+ const end = this._textarea.selectionEnd ?? this._textarea.value.length;
98
+ this._compositionPosition.end = Math.max( this._compositionPosition.start, end);
78
99
  }, 0);
79
100
  }
80
101
 
@@ -141,6 +162,7 @@ export class CompositionHelper {
141
162
  start: this._compositionPosition.start,
142
163
  end: this._compositionPosition.end
143
164
  };
165
+ const currentCompositionSuffix = this._compositionSuffix;
144
166
 
145
167
  // Since composition* events happen before the changes take place in the textarea on most
146
168
  // browsers, use a setTimeout with 0ms time to allow the native compositionend event to
@@ -164,10 +186,14 @@ export class CompositionHelper {
164
186
  // if a new composition has started.
165
187
  input = this._textarea.value.substring(currentCompositionPosition.start, this._compositionPosition.start);
166
188
  } else {
167
- // Don't use the end position here in order to pick up any characters after the
168
- // composition has finished, for example when typing a non-composition character
169
- // (eg. 2) after a composition character.
170
- input = this._textarea.value.substring(currentCompositionPosition.start);
189
+ // Keep support for non-composition characters typed immediately after composition end
190
+ // while avoiding re-sending the trailing text that was already present
191
+ // before composition started.
192
+ const value = this._textarea.value;
193
+ const valueEnd = currentCompositionSuffix.length > 0 && value.endsWith(currentCompositionSuffix)
194
+ ? value.length - currentCompositionSuffix.length
195
+ : value.length;
196
+ input = value.substring(currentCompositionPosition.start, Math.max(currentCompositionPosition.start, valueEnd));
171
197
  }
172
198
  if (input.length > 0) {
173
199
  this._coreService.triggerDataEvent(input, true);
@@ -184,8 +210,12 @@ export class CompositionHelper {
184
210
  * IME is active.
185
211
  */
186
212
  private _handleAnyTextareaChanges(): void {
213
+ if (this._textareaChangeTimer) {
214
+ return;
215
+ }
187
216
  const oldValue = this._textarea.value;
188
- setTimeout(() => {
217
+ this._textareaChangeTimer = window.setTimeout(() => {
218
+ this._textareaChangeTimer = undefined;
189
219
  // Ignore if a composition has started since the timeout
190
220
  if (!this._isComposing) {
191
221
  const newValue = this._textarea.value;
@@ -230,6 +260,12 @@ export class CompositionHelper {
230
260
  this._compositionView.style.lineHeight = cellHeight + 'px';
231
261
  this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;
232
262
  this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';
263
+ // Limit the composition view width to the space between the cursor and
264
+ // the terminal's right edge, preventing it from overflowing the terminal.
265
+ const maxWidth = this._bufferService.cols * this._renderService.dimensions.css.cell.width - cursorLeft;
266
+ this._compositionView.style.maxWidth = maxWidth + 'px';
267
+ this._compositionView.style.overflow = 'hidden';
268
+ this._compositionView.style.direction = 'rtl';
233
269
  // Sync the textarea to the exact position of the composition view so the IME knows where the
234
270
  // text is.
235
271
  const compositionViewBounds = this._compositionView.getBoundingClientRect();
@@ -6,14 +6,14 @@
6
6
  import * as Strings from 'browser/LocalizableStrings';
7
7
  import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
8
8
  import { IBufferRange, ITerminal } from 'browser/Types';
9
- import { Disposable } from 'vs/base/common/lifecycle';
9
+ import { Disposable } from 'common/Lifecycle';
10
10
  import { ITerminalOptions } from 'common/Types';
11
11
  import { AddonManager } from 'common/public/AddonManager';
12
12
  import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
13
13
  import { ParserApi } from 'common/public/ParserApi';
14
14
  import { UnicodeApi } from 'common/public/UnicodeApi';
15
- import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
16
- import type { Event } from 'vs/base/common/event';
15
+ import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
16
+ import type { IEvent } from 'common/Event';
17
17
 
18
18
  /**
19
19
  * The set of options that only have an effect when set in the Terminal constructor.
@@ -68,25 +68,24 @@ export class Terminal extends Disposable implements ITerminalApi {
68
68
  }
69
69
  }
70
70
 
71
- public get onBell(): Event<void> { return this._core.onBell; }
72
- public get onBinary(): Event<string> { return this._core.onBinary; }
73
- public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
74
- public get onData(): Event<string> { return this._core.onData; }
75
- public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
76
- public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
77
- public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
78
- public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
79
- public get onScroll(): Event<number> { return this._core.onScroll; }
80
- public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
81
- public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
82
- public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
71
+ public get onBell(): IEvent<void> { return this._core.onBell; }
72
+ public get onBinary(): IEvent<string> { return this._core.onBinary; }
73
+ public get onCursorMove(): IEvent<void> { return this._core.onCursorMove; }
74
+ public get onData(): IEvent<string> { return this._core.onData; }
75
+ public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
76
+ public get onLineFeed(): IEvent<void> { return this._core.onLineFeed; }
77
+ public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }
78
+ public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }
79
+ public get onScroll(): IEvent<number> { return this._core.onScroll; }
80
+ public get onSelectionChange(): IEvent<void> { return this._core.onSelectionChange; }
81
+ public get onTitleChange(): IEvent<string> { return this._core.onTitleChange; }
82
+ public get onWriteParsed(): IEvent<void> { return this._core.onWriteParsed; }
83
+ public get onDimensionsChange(): IEvent<IRenderDimensions> { return this._core.onDimensionsChange; }
83
84
 
84
85
  public get element(): HTMLElement | undefined { return this._core.element; }
86
+ public get screenElement(): HTMLElement | undefined { return this._core.screenElement; }
85
87
  public get parser(): IParser {
86
- if (!this._parser) {
87
- this._parser = new ParserApi(this._core);
88
- }
89
- return this._parser;
88
+ return this._parser ??= new ParserApi(this._core);
90
89
  }
91
90
  public get unicode(): IUnicodeHandling {
92
91
  this._checkProposedApi();
@@ -96,19 +95,15 @@ export class Terminal extends Disposable implements ITerminalApi {
96
95
  public get rows(): number { return this._core.rows; }
97
96
  public get cols(): number { return this._core.cols; }
98
97
  public get buffer(): IBufferNamespaceApi {
99
- if (!this._buffer) {
100
- this._buffer = this._register(new BufferNamespaceApi(this._core));
101
- }
102
- return this._buffer;
98
+ return this._buffer ??= this._register(new BufferNamespaceApi(this._core));
103
99
  }
104
100
  public get markers(): ReadonlyArray<IMarker> {
105
- this._checkProposedApi();
106
101
  return this._core.markers;
107
102
  }
108
103
  public get modes(): IModes {
109
104
  const m = this._core.coreService.decPrivateModes;
110
105
  let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';
111
- switch (this._core.coreMouseService.activeProtocol) {
106
+ switch (this._core.mouseStateService.activeProtocol) {
112
107
  case 'X10': mouseTrackingMode = 'x10'; break;
113
108
  case 'VT200': mouseTrackingMode = 'vt200'; break;
114
109
  case 'DRAG': mouseTrackingMode = 'drag'; break;
@@ -123,10 +118,15 @@ export class Terminal extends Disposable implements ITerminalApi {
123
118
  originMode: m.origin,
124
119
  reverseWraparoundMode: m.reverseWraparound,
125
120
  sendFocusMode: m.sendFocus,
121
+ showCursor: !this._core.coreService.isCursorHidden,
126
122
  synchronizedOutputMode: m.synchronizedOutput,
123
+ win32InputMode: m.win32InputMode,
127
124
  wraparoundMode: m.wraparound
128
125
  };
129
126
  }
127
+ public get dimensions(): IRenderDimensions | undefined {
128
+ return this._core.dimensions;
129
+ }
130
130
  public get options(): Required<ITerminalOptions> {
131
131
  return this._publicOptions;
132
132
  }
@@ -161,11 +161,9 @@ export class Terminal extends Disposable implements ITerminalApi {
161
161
  return this._core.registerLinkProvider(linkProvider);
162
162
  }
163
163
  public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {
164
- this._checkProposedApi();
165
164
  return this._core.registerCharacterJoiner(handler);
166
165
  }
167
166
  public deregisterCharacterJoiner(joinerId: number): void {
168
- this._checkProposedApi();
169
167
  this._core.deregisterCharacterJoiner(joinerId);
170
168
  }
171
169
  public registerMarker(cursorYOffset: number = 0): IMarker {
@@ -173,7 +171,6 @@ export class Terminal extends Disposable implements ITerminalApi {
173
171
  return this._core.registerMarker(cursorYOffset);
174
172
  }
175
173
  public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {
176
- this._checkProposedApi();
177
174
  this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);
178
175
  return this._core.registerDecoration(decorationOptions);
179
176
  }