@xterm/xterm 6.1.0-beta.3 → 6.1.0-beta.300

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 +69 -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 +57 -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 +180 -352
  12. package/src/browser/Dom.ts +178 -0
  13. package/src/browser/Linkifier.ts +14 -14
  14. package/src/browser/OscLinkProvider.ts +87 -19
  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 +4 -3
  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 +610 -23
  56. package/src/browser/services/RenderService.ts +33 -22
  57. package/src/browser/services/SelectionService.ts +73 -55
  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 +62 -38
  64. package/src/common/Event.ts +118 -0
  65. package/src/common/InputHandler.ts +303 -104
  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 +9 -0
  73. package/src/common/WindowsMode.ts +2 -2
  74. package/src/common/buffer/AttributeData.ts +3 -2
  75. package/src/common/buffer/Buffer.ts +49 -34
  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 +5 -8
  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 -10
  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 -54
  116. package/src/common/services/UnicodeService.ts +6 -11
  117. package/typings/xterm.d.ts +333 -47
  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
  */
@@ -77,15 +86,6 @@ declare module '@xterm/xterm' {
77
86
  */
78
87
  cursorInactiveStyle?: 'outline' | 'block' | 'bar' | 'underline' | 'none';
79
88
 
80
- /**
81
- * Whether to draw custom glyphs for block element and box drawing
82
- * characters instead of using the font. This should typically result in
83
- * better rendering with continuous lines, even when line height and letter
84
- * spacing is used. Note that this doesn't work with the DOM renderer which
85
- * renders all characters using the font. The default is true.
86
- */
87
- customGlyphs?: boolean;
88
-
89
89
  /**
90
90
  * Whether input should be disabled.
91
91
  */
@@ -206,10 +206,28 @@ declare module '@xterm/xterm' {
206
206
  */
207
207
  minimumContrastRatio?: number;
208
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
+
209
226
  /**
210
227
  * Whether to reflow the line containing the cursor when the terminal is
211
228
  * resized. Defaults to false, because shells usually handle this
212
- * themselves.
229
+ * themselves. Note that this will not move the cursor position, only the
230
+ * line contents.
213
231
  */
214
232
  reflowCursorLine?: boolean;
215
233
 
@@ -268,6 +286,11 @@ declare module '@xterm/xterm' {
268
286
  */
269
287
  scrollSensitivity?: number;
270
288
 
289
+ /**
290
+ * Options for configuring the scrollbar.
291
+ */
292
+ scrollbar?: IScrollbarOptions;
293
+
271
294
  /**
272
295
  * The duration to smoothly scroll between the origin and the target in
273
296
  * milliseconds. Set to 0 to disable smooth scrolling and scroll instantly.
@@ -284,6 +307,11 @@ declare module '@xterm/xterm' {
284
307
  */
285
308
  theme?: ITheme;
286
309
 
310
+ /**
311
+ * Enable various VT extensions.
312
+ */
313
+ vtExtensions?: IVtExtensions;
314
+
287
315
  /**
288
316
  * Compatibility information when the pty is known to be hosted on Windows.
289
317
  * Setting this will turn on certain heuristics/workarounds depending on the
@@ -313,12 +341,6 @@ declare module '@xterm/xterm' {
313
341
  * All features are disabled by default for security reasons.
314
342
  */
315
343
  windowOptions?: IWindowOptions;
316
-
317
- /**
318
- * Controls the visibility and style of the overview ruler which visualizes
319
- * decorations underneath the scroll bar.
320
- */
321
- overviewRuler?: IOverviewRulerOptions;
322
344
  }
323
345
 
324
346
  /**
@@ -335,6 +357,13 @@ declare module '@xterm/xterm' {
335
357
  * The number of rows in the terminal.
336
358
  */
337
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;
338
367
  }
339
368
 
340
369
  /**
@@ -360,23 +389,23 @@ declare module '@xterm/xterm' {
360
389
  selectionInactiveBackground?: string;
361
390
  /**
362
391
  * The scrollbar slider background color. Defaults to
363
- * {@link ITerminalOptions.foreground foreground} with 20% opacity.
392
+ * {@link ITheme.foreground} with 20% opacity.
364
393
  */
365
394
  scrollbarSliderBackground?: string;
366
395
  /**
367
396
  * The scrollbar slider background color when hovered. Defaults to
368
- * {@link ITerminalOptions.foreground foreground} with 40% opacity.
397
+ * {@link ITheme.foreground} with 40% opacity.
369
398
  */
370
399
  scrollbarSliderHoverBackground?: string;
371
400
  /**
372
401
  * The scrollbar slider background color when clicked. Defaults to
373
- * {@link ITerminalOptions.foreground foreground} with 50% opacity.
402
+ * {@link ITheme.foreground} with 50% opacity.
374
403
  */
375
404
  scrollbarSliderActiveBackground?: string;
376
405
  /**
377
406
  * The border color of the overview ruler. This visually separates the
378
- * terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
379
- * 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`).
380
409
  */
381
410
  overviewRulerBorder?: string;
382
411
  /** ANSI black (eg. `\x1b[30m`) */
@@ -415,6 +444,66 @@ declare module '@xterm/xterm' {
415
444
  extendedAnsi?: string[];
416
445
  }
417
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
+
418
507
  /**
419
508
  * Pty information for Windows.
420
509
  */
@@ -604,8 +693,8 @@ declare module '@xterm/xterm' {
604
693
 
605
694
  /**
606
695
  * When defined, renders the decoration in the overview ruler to the right
607
- * of the terminal. {@link IOverviewRulerOptions.width} must be set in order
608
- * to see the overview ruler.
696
+ * of the terminal. {@link IScrollbarOptions.width} must be set in order to
697
+ * see the overview ruler.
609
698
  * @param color The color of the decoration.
610
699
  * @param position The position of the decoration.
611
700
  */
@@ -628,15 +717,10 @@ declare module '@xterm/xterm' {
628
717
  tooMuchOutput: string;
629
718
  }
630
719
 
720
+ /**
721
+ * Options for configuring the overview ruler rendered beside the scrollbar.
722
+ */
631
723
  export interface IOverviewRulerOptions {
632
- /**
633
- * When defined, renders decorations in the overview ruler to the right of
634
- * the terminal. This must be set in order to see the overview ruler.
635
- * @param color The color of the decoration.
636
- * @param position The position of the decoration.
637
- */
638
- width?: number;
639
-
640
724
  /**
641
725
  * Whether to show the top border of the overview ruler, which uses the
642
726
  * {@link ITheme.overviewRulerBorder} color.
@@ -650,6 +734,34 @@ declare module '@xterm/xterm' {
650
734
  showBottomBorder?: boolean;
651
735
  }
652
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
+
653
765
  /**
654
766
  * Enable various window manipulation and report features
655
767
  * (`CSI Ps ; Ps ; Ps t`).
@@ -816,6 +928,12 @@ declare module '@xterm/xterm' {
816
928
  */
817
929
  readonly element: HTMLElement | undefined;
818
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
+
819
937
  /**
820
938
  * The textarea that accepts input for the terminal.
821
939
  */
@@ -841,8 +959,8 @@ declare module '@xterm/xterm' {
841
959
  readonly buffer: IBufferNamespace;
842
960
 
843
961
  /**
844
- * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
845
- * 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 [].
846
964
  */
847
965
  readonly markers: ReadonlyArray<IMarker>;
848
966
 
@@ -852,8 +970,8 @@ declare module '@xterm/xterm' {
852
970
  readonly parser: IParser;
853
971
 
854
972
  /**
855
- * (EXPERIMENTAL) Get the Unicode handling interface
856
- * to register and switch Unicode version.
973
+ * (EXPERIMENTAL) Get the Unicode handling interface to register and switch
974
+ * Unicode version.
857
975
  */
858
976
  readonly unicode: IUnicodeHandling;
859
977
 
@@ -862,6 +980,12 @@ declare module '@xterm/xterm' {
862
980
  */
863
981
  readonly modes: IModes;
864
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
+
865
989
  /**
866
990
  * Gets or sets the terminal options. This supports setting multiple
867
991
  * options.
@@ -1002,6 +1126,12 @@ declare module '@xterm/xterm' {
1002
1126
  */
1003
1127
  onTitleChange: IEvent<string>;
1004
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
+
1005
1135
  /**
1006
1136
  * Unfocus the terminal.
1007
1137
  */
@@ -1102,9 +1232,9 @@ declare module '@xterm/xterm' {
1102
1232
  registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
1103
1233
 
1104
1234
  /**
1105
- * (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
1106
- * characters to be rendered as a single unit. This is useful in particular
1107
- * 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.
1108
1238
  *
1109
1239
  * Each registered character joiner is called with a string of text
1110
1240
  * representing a portion of a line in the terminal that can be rendered as
@@ -1122,8 +1252,6 @@ declare module '@xterm/xterm' {
1122
1252
  * render together, since they aren't drawn as optimally as individual
1123
1253
  * characters.
1124
1254
  *
1125
- * NOTE: character joiners are only used by the webgl renderer.
1126
- *
1127
1255
  * @param handler The function that determines character joins. It is called
1128
1256
  * with a string of text that is eligible for joining and returns an array
1129
1257
  * where each entry is an array containing the start (inclusive) and end
@@ -1133,8 +1261,8 @@ declare module '@xterm/xterm' {
1133
1261
  registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
1134
1262
 
1135
1263
  /**
1136
- * (EXPERIMENTAL) Deregisters the character joiner if one was registered.
1137
- * 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.
1138
1266
  * @param joinerId The character joiner's ID (returned after register)
1139
1267
  */
1140
1268
  deregisterCharacterJoiner(joinerId: number): void;
@@ -1147,7 +1275,7 @@ declare module '@xterm/xterm' {
1147
1275
  registerMarker(cursorYOffset?: number): IMarker;
1148
1276
 
1149
1277
  /**
1150
- * (EXPERIMENTAL) Adds a decoration to the terminal using
1278
+ * Registers a decoration to the terminal.
1151
1279
  * @param decorationOptions, which takes a marker and an optional anchor,
1152
1280
  * width, height, and x offset from the anchor. Returns the decoration or
1153
1281
  * undefined if the alt buffer is active or the marker has already been
@@ -1736,6 +1864,26 @@ declare module '@xterm/xterm' {
1736
1864
 
1737
1865
  /** Whether the cell has the default attribute (no color or style). */
1738
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;
1739
1887
  }
1740
1888
 
1741
1889
  /**
@@ -1772,12 +1920,12 @@ declare module '@xterm/xterm' {
1772
1920
  prefix?: string;
1773
1921
  /**
1774
1922
  * Optional intermediate bytes, must be in range \x20 .. \x2f.
1775
- * Usable in CSI, DCS and ESC.
1923
+ * Usable in CSI, DCS, ESC and APC.
1776
1924
  */
1777
1925
  intermediates?: string;
1778
1926
  /**
1779
1927
  * Final byte, must be in range \x40 .. \x7e for CSI and DCS,
1780
- * \x30 .. \x7e for ESC.
1928
+ * \x30 .. \x7e for ESC and APC.
1781
1929
  */
1782
1930
  final: string;
1783
1931
  }
@@ -1839,7 +1987,7 @@ declare module '@xterm/xterm' {
1839
1987
  * @param id Specifies the function identifier under which the callback gets
1840
1988
  * registered, e.g. {intermediates: '%' final: 'G'} for default charset
1841
1989
  * selection.
1842
- * @param callback The function to handle the sequence.
1990
+ * @param handler The function to handle the sequence.
1843
1991
  * Return `true` if the sequence was handled, `false` if the parser should
1844
1992
  * try a previous handler. The most recently added handler is tried first.
1845
1993
  * @returns An IDisposable you can call to remove this handler.
@@ -1862,6 +2010,24 @@ declare module '@xterm/xterm' {
1862
2010
  * @returns An IDisposable you can call to remove this handler.
1863
2011
  */
1864
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;
1865
2031
  }
1866
2032
 
1867
2033
  /**
@@ -1942,6 +2108,10 @@ declare module '@xterm/xterm' {
1942
2108
  * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1943
2109
  */
1944
2110
  readonly sendFocusMode: boolean;
2111
+ /**
2112
+ * Show Cursor (DECTCEM): `CSI ? 2 5 h`
2113
+ */
2114
+ readonly showCursor: boolean;
1945
2115
  /**
1946
2116
  * Synchronized Output Mode: `CSI ? 2 0 2 6 h`
1947
2117
  *
@@ -1949,9 +2119,125 @@ declare module '@xterm/xterm' {
1949
2119
  * disabled, allowing for atomic screen updates without tearing.
1950
2120
  */
1951
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;
1952
2129
  /**
1953
2130
  * Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
1954
2131
  */
1955
2132
  readonly wraparoundMode: boolean;
1956
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
+ }
1957
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
- }