@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
@@ -58,10 +58,19 @@ declare module '@xterm/xterm' {
58
58
  convertEol?: boolean;
59
59
 
60
60
  /**
61
- * Whether the cursor blinks.
61
+ * Whether the cursor blinks. The blinking will stop after 5 minutes of idle
62
+ * time (refreshed by clicking, focusing or the cursor moving). The default
63
+ * is false.
62
64
  */
63
65
  cursorBlink?: boolean;
64
66
 
67
+ /**
68
+ * The interval in milliseconds for the blink attribute. This is the amount
69
+ * of time text remains visible or hidden before toggling. Set to 0 to
70
+ * disable blinking. The default is 0.
71
+ */
72
+ blinkIntervalDuration?: number;
73
+
65
74
  /**
66
75
  * The style of the cursor when the terminal is focused.
67
76
  */
@@ -197,10 +206,28 @@ declare module '@xterm/xterm' {
197
206
  */
198
207
  minimumContrastRatio?: number;
199
208
 
209
+ /**
210
+ * When enabled and the terminal is in mouse events mode, mouse click, drag,
211
+ * and move events are only sent to the underlying application when the alt
212
+ * key is held. The alt key is not included in the mouse reports sent to the
213
+ * application. Wheel events are not affected. This allows normal text
214
+ * selection by default while still supporting application mouse interaction
215
+ * and scrolling when holding alt. When enabled, this takes precedence over
216
+ * `macOptionClickForcesSelection`.
217
+ */
218
+ mouseEventsRequireAlt?: boolean;
219
+
220
+ /**
221
+ * Control various quirks features that are either non-standard or standard
222
+ * in but generally rejected in modern terminals.
223
+ */
224
+ quirks?: ITerminalQuirks;
225
+
200
226
  /**
201
227
  * Whether to reflow the line containing the cursor when the terminal is
202
228
  * resized. Defaults to false, because shells usually handle this
203
- * themselves.
229
+ * themselves. Note that this will not move the cursor position, only the
230
+ * line contents.
204
231
  */
205
232
  reflowCursorLine?: boolean;
206
233
 
@@ -259,6 +286,11 @@ declare module '@xterm/xterm' {
259
286
  */
260
287
  scrollSensitivity?: number;
261
288
 
289
+ /**
290
+ * Options for configuring the scrollbar.
291
+ */
292
+ scrollbar?: IScrollbarOptions;
293
+
262
294
  /**
263
295
  * The duration to smoothly scroll between the origin and the target in
264
296
  * milliseconds. Set to 0 to disable smooth scrolling and scroll instantly.
@@ -275,6 +307,11 @@ declare module '@xterm/xterm' {
275
307
  */
276
308
  theme?: ITheme;
277
309
 
310
+ /**
311
+ * Enable various VT extensions.
312
+ */
313
+ vtExtensions?: IVtExtensions;
314
+
278
315
  /**
279
316
  * Compatibility information when the pty is known to be hosted on Windows.
280
317
  * Setting this will turn on certain heuristics/workarounds depending on the
@@ -304,12 +341,6 @@ declare module '@xterm/xterm' {
304
341
  * All features are disabled by default for security reasons.
305
342
  */
306
343
  windowOptions?: IWindowOptions;
307
-
308
- /**
309
- * Controls the visibility and style of the overview ruler which visualizes
310
- * decorations underneath the scroll bar.
311
- */
312
- overviewRuler?: IOverviewRulerOptions;
313
344
  }
314
345
 
315
346
  /**
@@ -326,6 +357,13 @@ declare module '@xterm/xterm' {
326
357
  * The number of rows in the terminal.
327
358
  */
328
359
  rows?: number;
360
+
361
+ /**
362
+ * Whether to show the cursor immediately when the terminal is created.
363
+ * When false (default), the cursor will not be visible until the terminal
364
+ * is focused for the first time.
365
+ */
366
+ showCursorImmediately?: boolean;
329
367
  }
330
368
 
331
369
  /**
@@ -366,8 +404,8 @@ declare module '@xterm/xterm' {
366
404
  scrollbarSliderActiveBackground?: string;
367
405
  /**
368
406
  * The border color of the overview ruler. This visually separates the
369
- * terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
370
- * set. When this is not set it defaults to black (`#000000`).
407
+ * terminal from the scroll bar when {@link IScrollbarOptions.width} is set.
408
+ * When this is not set it defaults to black (`#000000`).
371
409
  */
372
410
  overviewRulerBorder?: string;
373
411
  /** ANSI black (eg. `\x1b[30m`) */
@@ -406,6 +444,66 @@ declare module '@xterm/xterm' {
406
444
  extendedAnsi?: string[];
407
445
  }
408
446
 
447
+ /**
448
+ * Control various quirks features that are either non-standard or standard
449
+ * in but generally rejected in modern terminals.
450
+ */
451
+ export interface ITerminalQuirks {
452
+ /**
453
+ * Enables support for DECSET 12 and DECRST 12 which controls cursor blink.
454
+ * Programs such as `vim` may use this to set the cursor blink state but may
455
+ * not change it back when exiting. Generally the terminal emulator should
456
+ * be in control of whether the cursor blinks or not and the application in
457
+ * modern terminals. Note that DECRQM works regardless of this option.
458
+ */
459
+ allowSetCursorBlink?: boolean;
460
+ }
461
+
462
+ /**
463
+ * Enable certain optional VT extensions.
464
+ */
465
+ export interface IVtExtensions {
466
+ /**
467
+ * Whether the [kitty keyboard protocol][0] (`CSI =|?|>|< u`) is enabled.
468
+ * When enabled, the terminal will respond to keyboard protocol queries and
469
+ * allow programs to enable enhanced keyboard reporting. The default is
470
+ * false.
471
+ *
472
+ * [0]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
473
+ */
474
+ kittyKeyboard?: boolean;
475
+
476
+ /**
477
+ * Whether [SGR 221 (not bold) and SGR 222 (not faint) are enabled][0].
478
+ * These are kitty extensions that allow resetting bold and faint
479
+ * independently. The default is true.
480
+ *
481
+ * [0]: https://sw.kovidgoyal.net/kitty/misc-protocol/
482
+ */
483
+ kittySgrBoldFaintControl?: boolean;
484
+
485
+ /**
486
+ * Whether [win32-input-mode][0] (`DECSET 9001`) is enabled. When enabled,
487
+ * the terminal will allow programs to enable win32 INPUT_RECORD keyboard
488
+ * reporting via `CSI ? 9001 h`. The default is false.
489
+ *
490
+ * [0]: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
491
+ */
492
+ win32InputMode?: boolean;
493
+
494
+ /**
495
+ * Whether [color scheme query and notification][0] (`CSI ? 996 n` and
496
+ * `DECSET 2031`) is enabled. When enabled, the terminal will respond to
497
+ * color scheme queries with `CSI ? 997 ; 1 n` (dark) or `CSI ? 997 ; 2 n`
498
+ * (light) based on the relative luminance of the background and foreground
499
+ * theme colors. Programs can enable unsolicited notifications via
500
+ * `CSI ? 2031 h`. The default is true.
501
+ *
502
+ * [0]: https://contour-terminal.org/vt-extensions/color-palette-update-notifications/
503
+ */
504
+ colorSchemeQuery?: boolean;
505
+ }
506
+
409
507
  /**
410
508
  * Pty information for Windows.
411
509
  */
@@ -595,8 +693,8 @@ declare module '@xterm/xterm' {
595
693
 
596
694
  /**
597
695
  * When defined, renders the decoration in the overview ruler to the right
598
- * of the terminal. {@link IOverviewRulerOptions.width} must be set in order
599
- * to see the overview ruler.
696
+ * of the terminal. {@link IScrollbarOptions.width} must be set in order to
697
+ * see the overview ruler.
600
698
  * @param color The color of the decoration.
601
699
  * @param position The position of the decoration.
602
700
  */
@@ -619,15 +717,10 @@ declare module '@xterm/xterm' {
619
717
  tooMuchOutput: string;
620
718
  }
621
719
 
720
+ /**
721
+ * Options for configuring the overview ruler rendered beside the scrollbar.
722
+ */
622
723
  export interface IOverviewRulerOptions {
623
- /**
624
- * When defined, renders decorations in the overview ruler to the right of
625
- * the terminal. This must be set in order to see the overview ruler.
626
- * @param color The color of the decoration.
627
- * @param position The position of the decoration.
628
- */
629
- width?: number;
630
-
631
724
  /**
632
725
  * Whether to show the top border of the overview ruler, which uses the
633
726
  * {@link ITheme.overviewRulerBorder} color.
@@ -641,6 +734,34 @@ declare module '@xterm/xterm' {
641
734
  showBottomBorder?: boolean;
642
735
  }
643
736
 
737
+ /**
738
+ * Options for configuring the scrollbar.
739
+ */
740
+ export interface IScrollbarOptions {
741
+ /**
742
+ * Whether to show the scrollbar. When false, this supersedes
743
+ * {@link IScrollbarOptions.width}. Defaults to true.
744
+ */
745
+ showScrollbar?: boolean;
746
+ /**
747
+ * Whether to show arrows at the top and bottom of the scrollbar. Defaults
748
+ * to false.
749
+ */
750
+ showArrows?: boolean;
751
+
752
+ /**
753
+ * The width of the scrollbar and overview ruler in CSS pixels. When set,
754
+ * this enables the overview ruler.
755
+ */
756
+ width?: number;
757
+
758
+ /**
759
+ * Controls the visibility and style of the overview ruler which visualizes
760
+ * decorations underneath the scroll bar.
761
+ */
762
+ overviewRuler?: IOverviewRulerOptions;
763
+ }
764
+
644
765
  /**
645
766
  * Enable various window manipulation and report features
646
767
  * (`CSI Ps ; Ps ; Ps t`).
@@ -807,6 +928,12 @@ declare module '@xterm/xterm' {
807
928
  */
808
929
  readonly element: HTMLElement | undefined;
809
930
 
931
+ /**
932
+ * The screen element containing the terminal's canvas rendering layers and
933
+ * decorations, excluding the viewport and the scrollbar.
934
+ */
935
+ readonly screenElement: HTMLElement | undefined;
936
+
810
937
  /**
811
938
  * The textarea that accepts input for the terminal.
812
939
  */
@@ -832,8 +959,8 @@ declare module '@xterm/xterm' {
832
959
  readonly buffer: IBufferNamespace;
833
960
 
834
961
  /**
835
- * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
836
- * buffer is active this will always return [].
962
+ * Get all markers registered against the buffer. If the alt buffer is
963
+ * active this will always return [].
837
964
  */
838
965
  readonly markers: ReadonlyArray<IMarker>;
839
966
 
@@ -843,8 +970,8 @@ declare module '@xterm/xterm' {
843
970
  readonly parser: IParser;
844
971
 
845
972
  /**
846
- * (EXPERIMENTAL) Get the Unicode handling interface
847
- * to register and switch Unicode version.
973
+ * (EXPERIMENTAL) Get the Unicode handling interface to register and switch
974
+ * Unicode version.
848
975
  */
849
976
  readonly unicode: IUnicodeHandling;
850
977
 
@@ -853,6 +980,12 @@ declare module '@xterm/xterm' {
853
980
  */
854
981
  readonly modes: IModes;
855
982
 
983
+ /**
984
+ * The dimensions of the terminal. This will be undefined before
985
+ * {@link open} is called.
986
+ */
987
+ readonly dimensions: IRenderDimensions | undefined;
988
+
856
989
  /**
857
990
  * Gets or sets the terminal options. This supports setting multiple
858
991
  * options.
@@ -993,6 +1126,12 @@ declare module '@xterm/xterm' {
993
1126
  */
994
1127
  onTitleChange: IEvent<string>;
995
1128
 
1129
+ /**
1130
+ * Adds an event listener for when the terminal's dimensions change.
1131
+ * @returns an `IDisposable` to stop listening.
1132
+ */
1133
+ onDimensionsChange: IEvent<IRenderDimensions>;
1134
+
996
1135
  /**
997
1136
  * Unfocus the terminal.
998
1137
  */
@@ -1093,9 +1232,9 @@ declare module '@xterm/xterm' {
1093
1232
  registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
1094
1233
 
1095
1234
  /**
1096
- * (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
1097
- * characters to be rendered as a single unit. This is useful in particular
1098
- * for rendering ligatures and graphemes, among other things.
1235
+ * Registers a character joiner, allowing custom sequences of characters to
1236
+ * be rendered as a single unit. This is useful in particular for rendering
1237
+ * ligatures and graphemes, among other things.
1099
1238
  *
1100
1239
  * Each registered character joiner is called with a string of text
1101
1240
  * representing a portion of a line in the terminal that can be rendered as
@@ -1113,8 +1252,6 @@ declare module '@xterm/xterm' {
1113
1252
  * render together, since they aren't drawn as optimally as individual
1114
1253
  * characters.
1115
1254
  *
1116
- * NOTE: character joiners are only used by the webgl renderer.
1117
- *
1118
1255
  * @param handler The function that determines character joins. It is called
1119
1256
  * with a string of text that is eligible for joining and returns an array
1120
1257
  * where each entry is an array containing the start (inclusive) and end
@@ -1124,8 +1261,8 @@ declare module '@xterm/xterm' {
1124
1261
  registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
1125
1262
 
1126
1263
  /**
1127
- * (EXPERIMENTAL) Deregisters the character joiner if one was registered.
1128
- * NOTE: character joiners are only used by the webgl renderer.
1264
+ * Deregisters the character joiner if one was registered. Note that
1265
+ * character joiners are only used by the webgl renderer.
1129
1266
  * @param joinerId The character joiner's ID (returned after register)
1130
1267
  */
1131
1268
  deregisterCharacterJoiner(joinerId: number): void;
@@ -1138,7 +1275,7 @@ declare module '@xterm/xterm' {
1138
1275
  registerMarker(cursorYOffset?: number): IMarker;
1139
1276
 
1140
1277
  /**
1141
- * (EXPERIMENTAL) Adds a decoration to the terminal using
1278
+ * Registers a decoration to the terminal.
1142
1279
  * @param decorationOptions, which takes a marker and an optional anchor,
1143
1280
  * width, height, and x offset from the anchor. Returns the decoration or
1144
1281
  * undefined if the alt buffer is active or the marker has already been
@@ -1727,6 +1864,26 @@ declare module '@xterm/xterm' {
1727
1864
 
1728
1865
  /** Whether the cell has the default attribute (no color or style). */
1729
1866
  isAttributeDefault(): boolean;
1867
+
1868
+ /** Gets the underline style. */
1869
+ getUnderlineStyle(): number;
1870
+ /** Gets the underline color number. */
1871
+ getUnderlineColor(): number;
1872
+ /** Gets the underline color mode. */
1873
+ getUnderlineColorMode(): number;
1874
+ /** Whether the cell is using the RGB underline color mode. */
1875
+ isUnderlineColorRGB(): boolean;
1876
+ /** Whether the cell is using the palette underline color mode. */
1877
+ isUnderlineColorPalette(): boolean;
1878
+ /** Whether the cell is using the default underline color mode. */
1879
+ isUnderlineColorDefault(): boolean;
1880
+
1881
+ /**
1882
+ * Compares the cell's attributes (colors and styles) with another cell.
1883
+ * This does not compare the cell's content and excludes URL ids and
1884
+ * underline variant offsets.
1885
+ */
1886
+ attributesEquals(other: IBufferCell): boolean;
1730
1887
  }
1731
1888
 
1732
1889
  /**
@@ -1763,12 +1920,12 @@ declare module '@xterm/xterm' {
1763
1920
  prefix?: string;
1764
1921
  /**
1765
1922
  * Optional intermediate bytes, must be in range \x20 .. \x2f.
1766
- * Usable in CSI, DCS and ESC.
1923
+ * Usable in CSI, DCS, ESC and APC.
1767
1924
  */
1768
1925
  intermediates?: string;
1769
1926
  /**
1770
1927
  * Final byte, must be in range \x40 .. \x7e for CSI and DCS,
1771
- * \x30 .. \x7e for ESC.
1928
+ * \x30 .. \x7e for ESC and APC.
1772
1929
  */
1773
1930
  final: string;
1774
1931
  }
@@ -1853,6 +2010,24 @@ declare module '@xterm/xterm' {
1853
2010
  * @returns An IDisposable you can call to remove this handler.
1854
2011
  */
1855
2012
  registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
2013
+
2014
+ /**
2015
+ * Adds a handler for APC escape sequences.
2016
+ * @param id Specifies the function identifier under which the callback
2017
+ * gets registered, e.g. {final: 'G'} for Kitty graphics protocol.
2018
+ * @param callback The function to handle the sequence. Note that the
2019
+ * function will only be called once if the sequence finished successfully.
2020
+ * There is currently no way to intercept smaller data chunks, data chunks
2021
+ * will be stored up until the sequence is finished. Since APC sequences are
2022
+ * not limited by the amount of data this might impose a problem for big
2023
+ * payloads. Currently xterm.js limits APC payload to 10 MB which should
2024
+ * give enough room for most use cases. The callback is called with APC data
2025
+ * string (excluding the identifier character). Return `true` if the
2026
+ * sequence was handled, `false` if the parser should try a previous
2027
+ * handler. The most recently added handler is tried first.
2028
+ * @returns An IDisposable you can call to remove this handler.
2029
+ */
2030
+ registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
1856
2031
  }
1857
2032
 
1858
2033
  /**
@@ -1933,6 +2108,10 @@ declare module '@xterm/xterm' {
1933
2108
  * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1934
2109
  */
1935
2110
  readonly sendFocusMode: boolean;
2111
+ /**
2112
+ * Show Cursor (DECTCEM): `CSI ? 2 5 h`
2113
+ */
2114
+ readonly showCursor: boolean;
1936
2115
  /**
1937
2116
  * Synchronized Output Mode: `CSI ? 2 0 2 6 h`
1938
2117
  *
@@ -1940,9 +2119,125 @@ declare module '@xterm/xterm' {
1940
2119
  * disabled, allowing for atomic screen updates without tearing.
1941
2120
  */
1942
2121
  readonly synchronizedOutputMode: boolean;
2122
+ /**
2123
+ * Win32 Input Mode: `CSI ? 9 0 0 1 h`
2124
+ *
2125
+ * When enabled, keyboard input is sent as Win32 INPUT_RECORD format:
2126
+ * `CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _`
2127
+ */
2128
+ readonly win32InputMode: boolean;
1943
2129
  /**
1944
2130
  * Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
1945
2131
  */
1946
2132
  readonly wraparoundMode: boolean;
1947
2133
  }
2134
+
2135
+ /**
2136
+ * An object containing a width and height in pixels.
2137
+ */
2138
+ export interface IDimensions {
2139
+ width: number;
2140
+ height: number;
2141
+ }
2142
+
2143
+ /**
2144
+ * An object containing a top and left offset.
2145
+ */
2146
+ export interface IOffset {
2147
+ top: number;
2148
+ left: number;
2149
+ }
2150
+
2151
+ /**
2152
+ * The dimensions of the terminal.
2153
+ */
2154
+ export interface IRenderDimensions {
2155
+ /**
2156
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2157
+ * ratio).
2158
+ */
2159
+ css: {
2160
+ /**
2161
+ * The dimensions of the canvas.
2162
+ */
2163
+ canvas: IDimensions;
2164
+ /**
2165
+ * The dimensions of a single cell.
2166
+ */
2167
+ cell: IDimensions;
2168
+ };
2169
+ /**
2170
+ * Dimensions measured in actual pixels as rendered to the device.
2171
+ */
2172
+ device: {
2173
+ /**
2174
+ * The dimensions of the canvas.
2175
+ */
2176
+ canvas: IDimensions;
2177
+ /**
2178
+ * The dimensions of a single cell.
2179
+ */
2180
+ cell: IDimensions;
2181
+ /**
2182
+ * The dimensions of a single character within a cell, including its
2183
+ * offset within the cell.
2184
+ */
2185
+ char: IDimensions & IOffset;
2186
+ };
2187
+ }
2188
+
2189
+ /**
2190
+ * An object containing a width and height in pixels.
2191
+ */
2192
+ export interface IDimensions {
2193
+ width: number;
2194
+ height: number;
2195
+ }
2196
+
2197
+ /**
2198
+ * An object containing a top and left offset.
2199
+ */
2200
+ export interface IOffset {
2201
+ top: number;
2202
+ left: number;
2203
+ }
2204
+
2205
+ /**
2206
+ * The dimensions of the terminal, this is constructed and available after
2207
+ * {@link Terminal.open} is called.
2208
+ */
2209
+ export interface IRenderDimensions {
2210
+ /**
2211
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2212
+ * ratio).
2213
+ */
2214
+ css: {
2215
+ /**
2216
+ * The dimensions of the canvas which is the full terminal size.
2217
+ */
2218
+ canvas: IDimensions;
2219
+ /**
2220
+ * The dimensions of a single cell.
2221
+ */
2222
+ cell: IDimensions;
2223
+ };
2224
+ /**
2225
+ * Dimensions measured in actual pixels as rendered to the device.
2226
+ */
2227
+ device: {
2228
+ /**
2229
+ * The dimensions of the canvas which is the full terminal size.
2230
+ */
2231
+ canvas: IDimensions;
2232
+ /**
2233
+ * The dimensions of a single cell.
2234
+ */
2235
+ cell: IDimensions;
2236
+ /**
2237
+ * The dimensions of a single character within a cell, including its
2238
+ * offset within the cell.
2239
+ */
2240
+ char: IDimensions & IOffset;
2241
+ };
2242
+ }
1948
2243
  }
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2016 The xterm.js authors. All rights reserved.
3
- * @license MIT
4
- */
5
-
6
- /*
7
- * A simple utility for cloning values
8
- */
9
- export function clone<T>(val: T, depth: number = 5): T {
10
- if (typeof val !== 'object') {
11
- return val;
12
- }
13
-
14
- // If we're cloning an array, use an array as the base, otherwise use an object
15
- const clonedObject: any = Array.isArray(val) ? [] : {};
16
-
17
- for (const key in val) {
18
- // Recursively clone eack item unless we're at the maximum depth
19
- clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));
20
- }
21
-
22
- return clonedObject as T;
23
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright (c) 2018 The xterm.js authors. All rights reserved.
3
- * @license MIT
4
- */
5
-
6
- export type TypedArray = Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
7
-
8
- /**
9
- * Concat two typed arrays `a` and `b`.
10
- * Returns a new typed array.
11
- */
12
- export function concat<T extends TypedArray>(a: T, b: T): T {
13
- const result = new (a.constructor as any)(a.length + b.length);
14
- result.set(a);
15
- result.set(b, a.length);
16
- return result;
17
- }