@xterm/xterm 6.1.0-beta.21 → 6.1.0-beta.211

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 (158) hide show
  1. package/README.md +61 -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 +24 -13
  8. package/src/browser/AccessibilityManager.ts +6 -3
  9. package/src/browser/Clipboard.ts +6 -3
  10. package/src/browser/CoreBrowserTerminal.ts +147 -318
  11. package/src/browser/Dom.ts +178 -0
  12. package/src/browser/Linkifier.ts +11 -11
  13. package/src/browser/OscLinkProvider.ts +3 -1
  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 +205 -41
  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 +579 -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 +22 -15
  49. package/src/browser/services/SelectionService.ts +16 -8
  50. package/src/browser/services/Services.ts +40 -17
  51. package/src/browser/services/ThemeService.ts +2 -2
  52. package/src/common/Async.ts +105 -0
  53. package/src/common/CircularList.ts +2 -2
  54. package/src/common/Color.ts +8 -0
  55. package/src/common/CoreTerminal.ts +28 -18
  56. package/src/common/Event.ts +118 -0
  57. package/src/common/InputHandler.ts +263 -43
  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/TaskQueue.ts +14 -5
  62. package/src/common/Types.ts +35 -15
  63. package/src/common/Version.ts +9 -0
  64. package/src/common/buffer/Buffer.ts +20 -14
  65. package/src/common/buffer/BufferLine.ts +4 -5
  66. package/src/common/buffer/BufferSet.ts +7 -6
  67. package/src/common/buffer/CellData.ts +57 -0
  68. package/src/common/buffer/Marker.ts +2 -2
  69. package/src/common/buffer/Types.ts +6 -2
  70. package/src/common/data/EscapeSequences.ts +71 -70
  71. package/src/common/input/Keyboard.ts +14 -7
  72. package/src/common/input/KittyKeyboard.ts +519 -0
  73. package/src/common/input/Win32InputMode.ts +297 -0
  74. package/src/common/input/WriteBuffer.ts +34 -2
  75. package/src/common/input/XParseColor.ts +2 -2
  76. package/src/common/parser/ApcParser.ts +245 -0
  77. package/src/common/parser/Constants.ts +22 -4
  78. package/src/common/parser/DcsParser.ts +5 -5
  79. package/src/common/parser/EscapeSequenceParser.ts +167 -57
  80. package/src/common/parser/OscParser.ts +5 -5
  81. package/src/common/parser/Params.ts +13 -0
  82. package/src/common/parser/Types.ts +36 -2
  83. package/src/common/public/BufferLineApiView.ts +2 -2
  84. package/src/common/public/BufferNamespaceApi.ts +2 -2
  85. package/src/common/public/ParserApi.ts +3 -0
  86. package/src/common/services/BufferService.ts +8 -5
  87. package/src/common/services/CharsetService.ts +4 -0
  88. package/src/common/services/CoreService.ts +18 -4
  89. package/src/common/services/DecorationService.ts +24 -8
  90. package/src/common/services/LogService.ts +1 -31
  91. package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +21 -132
  92. package/src/common/services/OptionsService.ts +13 -4
  93. package/src/common/services/Services.ts +47 -40
  94. package/src/common/services/UnicodeService.ts +1 -1
  95. package/typings/xterm.d.ts +316 -32
  96. package/src/common/TypedArrayUtils.ts +0 -17
  97. package/src/vs/base/browser/browser.ts +0 -141
  98. package/src/vs/base/browser/canIUse.ts +0 -49
  99. package/src/vs/base/browser/dom.ts +0 -2369
  100. package/src/vs/base/browser/fastDomNode.ts +0 -316
  101. package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
  102. package/src/vs/base/browser/iframe.ts +0 -135
  103. package/src/vs/base/browser/keyboardEvent.ts +0 -213
  104. package/src/vs/base/browser/mouseEvent.ts +0 -229
  105. package/src/vs/base/browser/touch.ts +0 -372
  106. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
  107. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
  108. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
  109. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
  110. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
  111. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
  112. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
  113. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
  114. package/src/vs/base/browser/ui/widget.ts +0 -57
  115. package/src/vs/base/browser/window.ts +0 -14
  116. package/src/vs/base/common/arrays.ts +0 -887
  117. package/src/vs/base/common/arraysFind.ts +0 -202
  118. package/src/vs/base/common/assert.ts +0 -71
  119. package/src/vs/base/common/async.ts +0 -1992
  120. package/src/vs/base/common/cancellation.ts +0 -148
  121. package/src/vs/base/common/charCode.ts +0 -450
  122. package/src/vs/base/common/collections.ts +0 -140
  123. package/src/vs/base/common/decorators.ts +0 -130
  124. package/src/vs/base/common/equals.ts +0 -146
  125. package/src/vs/base/common/errors.ts +0 -303
  126. package/src/vs/base/common/event.ts +0 -1778
  127. package/src/vs/base/common/functional.ts +0 -32
  128. package/src/vs/base/common/hash.ts +0 -316
  129. package/src/vs/base/common/iterator.ts +0 -159
  130. package/src/vs/base/common/keyCodes.ts +0 -526
  131. package/src/vs/base/common/keybindings.ts +0 -284
  132. package/src/vs/base/common/lazy.ts +0 -47
  133. package/src/vs/base/common/lifecycle.ts +0 -801
  134. package/src/vs/base/common/linkedList.ts +0 -142
  135. package/src/vs/base/common/map.ts +0 -202
  136. package/src/vs/base/common/numbers.ts +0 -98
  137. package/src/vs/base/common/observable.ts +0 -76
  138. package/src/vs/base/common/observableInternal/api.ts +0 -31
  139. package/src/vs/base/common/observableInternal/autorun.ts +0 -281
  140. package/src/vs/base/common/observableInternal/base.ts +0 -489
  141. package/src/vs/base/common/observableInternal/debugName.ts +0 -145
  142. package/src/vs/base/common/observableInternal/derived.ts +0 -428
  143. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
  144. package/src/vs/base/common/observableInternal/logging.ts +0 -328
  145. package/src/vs/base/common/observableInternal/promise.ts +0 -209
  146. package/src/vs/base/common/observableInternal/utils.ts +0 -610
  147. package/src/vs/base/common/platform.ts +0 -281
  148. package/src/vs/base/common/scrollable.ts +0 -522
  149. package/src/vs/base/common/sequence.ts +0 -34
  150. package/src/vs/base/common/stopwatch.ts +0 -43
  151. package/src/vs/base/common/strings.ts +0 -557
  152. package/src/vs/base/common/symbols.ts +0 -9
  153. package/src/vs/base/common/uint.ts +0 -59
  154. package/src/vs/patches/nls.ts +0 -90
  155. package/src/vs/typings/base-common.d.ts +0 -20
  156. package/src/vs/typings/require.d.ts +0 -42
  157. package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
  158. 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,17 @@ declare module '@xterm/xterm' {
197
206
  */
198
207
  minimumContrastRatio?: number;
199
208
 
209
+ /**
210
+ * Control various quirks features that are either non-standard or standard
211
+ * in but generally rejected in modern terminals.
212
+ */
213
+ quirks?: ITerminalQuirks;
214
+
200
215
  /**
201
216
  * Whether to reflow the line containing the cursor when the terminal is
202
217
  * resized. Defaults to false, because shells usually handle this
203
- * themselves.
218
+ * themselves. Note that this will not move the cursor position, only the
219
+ * line contents.
204
220
  */
205
221
  reflowCursorLine?: boolean;
206
222
 
@@ -259,6 +275,11 @@ declare module '@xterm/xterm' {
259
275
  */
260
276
  scrollSensitivity?: number;
261
277
 
278
+ /**
279
+ * Options for configuring the scrollbar.
280
+ */
281
+ scrollbar?: IScrollbarOptions;
282
+
262
283
  /**
263
284
  * The duration to smoothly scroll between the origin and the target in
264
285
  * milliseconds. Set to 0 to disable smooth scrolling and scroll instantly.
@@ -275,6 +296,11 @@ declare module '@xterm/xterm' {
275
296
  */
276
297
  theme?: ITheme;
277
298
 
299
+ /**
300
+ * Enable various VT extensions.
301
+ */
302
+ vtExtensions?: IVtExtensions;
303
+
278
304
  /**
279
305
  * Compatibility information when the pty is known to be hosted on Windows.
280
306
  * Setting this will turn on certain heuristics/workarounds depending on the
@@ -304,12 +330,6 @@ declare module '@xterm/xterm' {
304
330
  * All features are disabled by default for security reasons.
305
331
  */
306
332
  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
333
  }
314
334
 
315
335
  /**
@@ -326,6 +346,13 @@ declare module '@xterm/xterm' {
326
346
  * The number of rows in the terminal.
327
347
  */
328
348
  rows?: number;
349
+
350
+ /**
351
+ * Whether to show the cursor immediately when the terminal is created.
352
+ * When false (default), the cursor will not be visible until the terminal
353
+ * is focused for the first time.
354
+ */
355
+ showCursorImmediately?: boolean;
329
356
  }
330
357
 
331
358
  /**
@@ -366,8 +393,8 @@ declare module '@xterm/xterm' {
366
393
  scrollbarSliderActiveBackground?: string;
367
394
  /**
368
395
  * 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`).
396
+ * terminal from the scroll bar when {@link IScrollbarOptions.width} is set.
397
+ * When this is not set it defaults to black (`#000000`).
371
398
  */
372
399
  overviewRulerBorder?: string;
373
400
  /** ANSI black (eg. `\x1b[30m`) */
@@ -406,6 +433,66 @@ declare module '@xterm/xterm' {
406
433
  extendedAnsi?: string[];
407
434
  }
408
435
 
436
+ /**
437
+ * Control various quirks features that are either non-standard or standard
438
+ * in but generally rejected in modern terminals.
439
+ */
440
+ export interface ITerminalQuirks {
441
+ /**
442
+ * Enables support for DECSET 12 and DECRST 12 which controls cursor blink.
443
+ * Programs such as `vim` may use this to set the cursor blink state but may
444
+ * not change it back when exiting. Generally the terminal emulator should
445
+ * be in control of whether the cursor blinks or not and the application in
446
+ * modern terminals. Note that DECRQM works regardless of this option.
447
+ */
448
+ allowSetCursorBlink?: boolean;
449
+ }
450
+
451
+ /**
452
+ * Enable certain optional VT extensions.
453
+ */
454
+ export interface IVtExtensions {
455
+ /**
456
+ * Whether the [kitty keyboard protocol][0] (`CSI =|?|>|< u`) is enabled.
457
+ * When enabled, the terminal will respond to keyboard protocol queries and
458
+ * allow programs to enable enhanced keyboard reporting. The default is
459
+ * false.
460
+ *
461
+ * [0]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
462
+ */
463
+ kittyKeyboard?: boolean;
464
+
465
+ /**
466
+ * Whether [SGR 221 (not bold) and SGR 222 (not faint) are enabled][0].
467
+ * These are kitty extensions that allow resetting bold and faint
468
+ * independently. The default is true.
469
+ *
470
+ * [0]: https://sw.kovidgoyal.net/kitty/misc-protocol/
471
+ */
472
+ kittySgrBoldFaintControl?: boolean;
473
+
474
+ /**
475
+ * Whether [win32-input-mode][0] (`DECSET 9001`) is enabled. When enabled,
476
+ * the terminal will allow programs to enable win32 INPUT_RECORD keyboard
477
+ * reporting via `CSI ? 9001 h`. The default is false.
478
+ *
479
+ * [0]: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
480
+ */
481
+ win32InputMode?: boolean;
482
+
483
+ /**
484
+ * Whether [color scheme query and notification][0] (`CSI ? 996 n` and
485
+ * `DECSET 2031`) is enabled. When enabled, the terminal will respond to
486
+ * color scheme queries with `CSI ? 997 ; 1 n` (dark) or `CSI ? 997 ; 2 n`
487
+ * (light) based on the relative luminance of the background and foreground
488
+ * theme colors. Programs can enable unsolicited notifications via
489
+ * `CSI ? 2031 h`. The default is true.
490
+ *
491
+ * [0]: https://contour-terminal.org/vt-extensions/color-palette-update-notifications/
492
+ */
493
+ colorSchemeQuery?: boolean;
494
+ }
495
+
409
496
  /**
410
497
  * Pty information for Windows.
411
498
  */
@@ -595,8 +682,8 @@ declare module '@xterm/xterm' {
595
682
 
596
683
  /**
597
684
  * 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.
685
+ * of the terminal. {@link IScrollbarOptions.width} must be set in order to
686
+ * see the overview ruler.
600
687
  * @param color The color of the decoration.
601
688
  * @param position The position of the decoration.
602
689
  */
@@ -619,15 +706,10 @@ declare module '@xterm/xterm' {
619
706
  tooMuchOutput: string;
620
707
  }
621
708
 
709
+ /**
710
+ * Options for configuring the overview ruler rendered beside the scrollbar.
711
+ */
622
712
  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
713
  /**
632
714
  * Whether to show the top border of the overview ruler, which uses the
633
715
  * {@link ITheme.overviewRulerBorder} color.
@@ -641,6 +723,34 @@ declare module '@xterm/xterm' {
641
723
  showBottomBorder?: boolean;
642
724
  }
643
725
 
726
+ /**
727
+ * Options for configuring the scrollbar.
728
+ */
729
+ export interface IScrollbarOptions {
730
+ /**
731
+ * Whether to show the scrollbar. When false, this supersedes
732
+ * {@link IScrollbarOptions.width}. Defaults to true.
733
+ */
734
+ showScrollbar?: boolean;
735
+ /**
736
+ * Whether to show arrows at the top and bottom of the scrollbar. Defaults
737
+ * to false.
738
+ */
739
+ showArrows?: boolean;
740
+
741
+ /**
742
+ * The width of the scrollbar and overview ruler in CSS pixels. When set,
743
+ * this enables the overview ruler.
744
+ */
745
+ width?: number;
746
+
747
+ /**
748
+ * Controls the visibility and style of the overview ruler which visualizes
749
+ * decorations underneath the scroll bar.
750
+ */
751
+ overviewRuler?: IOverviewRulerOptions;
752
+ }
753
+
644
754
  /**
645
755
  * Enable various window manipulation and report features
646
756
  * (`CSI Ps ; Ps ; Ps t`).
@@ -807,6 +917,12 @@ declare module '@xterm/xterm' {
807
917
  */
808
918
  readonly element: HTMLElement | undefined;
809
919
 
920
+ /**
921
+ * The screen element containing the terminal's canvas rendering layers and
922
+ * decorations, excluding the viewport and the scrollbar.
923
+ */
924
+ readonly screenElement: HTMLElement | undefined;
925
+
810
926
  /**
811
927
  * The textarea that accepts input for the terminal.
812
928
  */
@@ -832,8 +948,8 @@ declare module '@xterm/xterm' {
832
948
  readonly buffer: IBufferNamespace;
833
949
 
834
950
  /**
835
- * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
836
- * buffer is active this will always return [].
951
+ * Get all markers registered against the buffer. If the alt buffer is
952
+ * active this will always return [].
837
953
  */
838
954
  readonly markers: ReadonlyArray<IMarker>;
839
955
 
@@ -843,8 +959,8 @@ declare module '@xterm/xterm' {
843
959
  readonly parser: IParser;
844
960
 
845
961
  /**
846
- * (EXPERIMENTAL) Get the Unicode handling interface
847
- * to register and switch Unicode version.
962
+ * (EXPERIMENTAL) Get the Unicode handling interface to register and switch
963
+ * Unicode version.
848
964
  */
849
965
  readonly unicode: IUnicodeHandling;
850
966
 
@@ -853,6 +969,12 @@ declare module '@xterm/xterm' {
853
969
  */
854
970
  readonly modes: IModes;
855
971
 
972
+ /**
973
+ * The dimensions of the terminal. This will be undefined before
974
+ * {@link open} is called.
975
+ */
976
+ readonly dimensions: IRenderDimensions | undefined;
977
+
856
978
  /**
857
979
  * Gets or sets the terminal options. This supports setting multiple
858
980
  * options.
@@ -993,6 +1115,12 @@ declare module '@xterm/xterm' {
993
1115
  */
994
1116
  onTitleChange: IEvent<string>;
995
1117
 
1118
+ /**
1119
+ * Adds an event listener for when the terminal's dimensions change.
1120
+ * @returns an `IDisposable` to stop listening.
1121
+ */
1122
+ onDimensionsChange: IEvent<IRenderDimensions>;
1123
+
996
1124
  /**
997
1125
  * Unfocus the terminal.
998
1126
  */
@@ -1093,9 +1221,9 @@ declare module '@xterm/xterm' {
1093
1221
  registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
1094
1222
 
1095
1223
  /**
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.
1224
+ * Registers a character joiner, allowing custom sequences of characters to
1225
+ * be rendered as a single unit. This is useful in particular for rendering
1226
+ * ligatures and graphemes, among other things.
1099
1227
  *
1100
1228
  * Each registered character joiner is called with a string of text
1101
1229
  * representing a portion of a line in the terminal that can be rendered as
@@ -1113,8 +1241,6 @@ declare module '@xterm/xterm' {
1113
1241
  * render together, since they aren't drawn as optimally as individual
1114
1242
  * characters.
1115
1243
  *
1116
- * NOTE: character joiners are only used by the webgl renderer.
1117
- *
1118
1244
  * @param handler The function that determines character joins. It is called
1119
1245
  * with a string of text that is eligible for joining and returns an array
1120
1246
  * where each entry is an array containing the start (inclusive) and end
@@ -1124,8 +1250,8 @@ declare module '@xterm/xterm' {
1124
1250
  registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
1125
1251
 
1126
1252
  /**
1127
- * (EXPERIMENTAL) Deregisters the character joiner if one was registered.
1128
- * NOTE: character joiners are only used by the webgl renderer.
1253
+ * Deregisters the character joiner if one was registered. Note that
1254
+ * character joiners are only used by the webgl renderer.
1129
1255
  * @param joinerId The character joiner's ID (returned after register)
1130
1256
  */
1131
1257
  deregisterCharacterJoiner(joinerId: number): void;
@@ -1138,7 +1264,7 @@ declare module '@xterm/xterm' {
1138
1264
  registerMarker(cursorYOffset?: number): IMarker;
1139
1265
 
1140
1266
  /**
1141
- * (EXPERIMENTAL) Adds a decoration to the terminal using
1267
+ * Registers a decoration to the terminal.
1142
1268
  * @param decorationOptions, which takes a marker and an optional anchor,
1143
1269
  * width, height, and x offset from the anchor. Returns the decoration or
1144
1270
  * undefined if the alt buffer is active or the marker has already been
@@ -1727,6 +1853,26 @@ declare module '@xterm/xterm' {
1727
1853
 
1728
1854
  /** Whether the cell has the default attribute (no color or style). */
1729
1855
  isAttributeDefault(): boolean;
1856
+
1857
+ /** Gets the underline style. */
1858
+ getUnderlineStyle(): number;
1859
+ /** Gets the underline color number. */
1860
+ getUnderlineColor(): number;
1861
+ /** Gets the underline color mode. */
1862
+ getUnderlineColorMode(): number;
1863
+ /** Whether the cell is using the RGB underline color mode. */
1864
+ isUnderlineColorRGB(): boolean;
1865
+ /** Whether the cell is using the palette underline color mode. */
1866
+ isUnderlineColorPalette(): boolean;
1867
+ /** Whether the cell is using the default underline color mode. */
1868
+ isUnderlineColorDefault(): boolean;
1869
+
1870
+ /**
1871
+ * Compares the cell's attributes (colors and styles) with another cell.
1872
+ * This does not compare the cell's content and excludes URL ids and
1873
+ * underline variant offsets.
1874
+ */
1875
+ attributesEquals(other: IBufferCell): boolean;
1730
1876
  }
1731
1877
 
1732
1878
  /**
@@ -1853,6 +1999,24 @@ declare module '@xterm/xterm' {
1853
1999
  * @returns An IDisposable you can call to remove this handler.
1854
2000
  */
1855
2001
  registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
2002
+
2003
+ /**
2004
+ * Adds a handler for APC escape sequences.
2005
+ * @param ident The identifier (first character) of the sequence as a
2006
+ * character code, e.g. 71 for 'G' (Kitty graphics protocol).
2007
+ * @param callback The function to handle the sequence. Note that the
2008
+ * function will only be called once if the sequence finished successfully.
2009
+ * There is currently no way to intercept smaller data chunks, data chunks
2010
+ * will be stored up until the sequence is finished. Since APC sequences are
2011
+ * not limited by the amount of data this might impose a problem for big
2012
+ * payloads. Currently xterm.js limits APC payload to 10 MB which should
2013
+ * give enough room for most use cases. The callback is called with APC data
2014
+ * string (excluding the identifier character). Return `true` if the
2015
+ * sequence was handled, `false` if the parser should try a previous
2016
+ * handler. The most recently added handler is tried first.
2017
+ * @returns An IDisposable you can call to remove this handler.
2018
+ */
2019
+ registerApcHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
1856
2020
  }
1857
2021
 
1858
2022
  /**
@@ -1933,6 +2097,10 @@ declare module '@xterm/xterm' {
1933
2097
  * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1934
2098
  */
1935
2099
  readonly sendFocusMode: boolean;
2100
+ /**
2101
+ * Show Cursor (DECTCEM): `CSI ? 2 5 h`
2102
+ */
2103
+ readonly showCursor: boolean;
1936
2104
  /**
1937
2105
  * Synchronized Output Mode: `CSI ? 2 0 2 6 h`
1938
2106
  *
@@ -1940,9 +2108,125 @@ declare module '@xterm/xterm' {
1940
2108
  * disabled, allowing for atomic screen updates without tearing.
1941
2109
  */
1942
2110
  readonly synchronizedOutputMode: boolean;
2111
+ /**
2112
+ * Win32 Input Mode: `CSI ? 9 0 0 1 h`
2113
+ *
2114
+ * When enabled, keyboard input is sent as Win32 INPUT_RECORD format:
2115
+ * `CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _`
2116
+ */
2117
+ readonly win32InputMode: boolean;
1943
2118
  /**
1944
2119
  * Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
1945
2120
  */
1946
2121
  readonly wraparoundMode: boolean;
1947
2122
  }
2123
+
2124
+ /**
2125
+ * An object containing a width and height in pixels.
2126
+ */
2127
+ export interface IDimensions {
2128
+ width: number;
2129
+ height: number;
2130
+ }
2131
+
2132
+ /**
2133
+ * An object containing a top and left offset.
2134
+ */
2135
+ export interface IOffset {
2136
+ top: number;
2137
+ left: number;
2138
+ }
2139
+
2140
+ /**
2141
+ * The dimensions of the terminal.
2142
+ */
2143
+ export interface IRenderDimensions {
2144
+ /**
2145
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2146
+ * ratio).
2147
+ */
2148
+ css: {
2149
+ /**
2150
+ * The dimensions of the canvas.
2151
+ */
2152
+ canvas: IDimensions;
2153
+ /**
2154
+ * The dimensions of a single cell.
2155
+ */
2156
+ cell: IDimensions;
2157
+ };
2158
+ /**
2159
+ * Dimensions measured in actual pixels as rendered to the device.
2160
+ */
2161
+ device: {
2162
+ /**
2163
+ * The dimensions of the canvas.
2164
+ */
2165
+ canvas: IDimensions;
2166
+ /**
2167
+ * The dimensions of a single cell.
2168
+ */
2169
+ cell: IDimensions;
2170
+ /**
2171
+ * The dimensions of a single character within a cell, including its
2172
+ * offset within the cell.
2173
+ */
2174
+ char: IDimensions & IOffset;
2175
+ };
2176
+ }
2177
+
2178
+ /**
2179
+ * An object containing a width and height in pixels.
2180
+ */
2181
+ export interface IDimensions {
2182
+ width: number;
2183
+ height: number;
2184
+ }
2185
+
2186
+ /**
2187
+ * An object containing a top and left offset.
2188
+ */
2189
+ export interface IOffset {
2190
+ top: number;
2191
+ left: number;
2192
+ }
2193
+
2194
+ /**
2195
+ * The dimensions of the terminal, this is constructed and available after
2196
+ * {@link Terminal.open} is called.
2197
+ */
2198
+ export interface IRenderDimensions {
2199
+ /**
2200
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2201
+ * ratio).
2202
+ */
2203
+ css: {
2204
+ /**
2205
+ * The dimensions of the canvas which is the full terminal size.
2206
+ */
2207
+ canvas: IDimensions;
2208
+ /**
2209
+ * The dimensions of a single cell.
2210
+ */
2211
+ cell: IDimensions;
2212
+ };
2213
+ /**
2214
+ * Dimensions measured in actual pixels as rendered to the device.
2215
+ */
2216
+ device: {
2217
+ /**
2218
+ * The dimensions of the canvas which is the full terminal size.
2219
+ */
2220
+ canvas: IDimensions;
2221
+ /**
2222
+ * The dimensions of a single cell.
2223
+ */
2224
+ cell: IDimensions;
2225
+ /**
2226
+ * The dimensions of a single character within a cell, including its
2227
+ * offset within the cell.
2228
+ */
2229
+ char: IDimensions & IOffset;
2230
+ };
2231
+ }
1948
2232
  }
@@ -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
- }
@@ -1,141 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- import { CodeWindow, mainWindow } from 'vs/base/browser/window';
7
- import { Emitter } from 'vs/base/common/event';
8
-
9
- class WindowManager {
10
-
11
- static readonly INSTANCE = new WindowManager();
12
-
13
- // --- Zoom Level
14
-
15
- private readonly mapWindowIdToZoomLevel = new Map<number, number>();
16
-
17
- private readonly _onDidChangeZoomLevel = new Emitter<number>();
18
- readonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
19
-
20
- getZoomLevel(targetWindow: Window): number {
21
- return this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;
22
- }
23
- setZoomLevel(zoomLevel: number, targetWindow: Window): void {
24
- if (this.getZoomLevel(targetWindow) === zoomLevel) {
25
- return;
26
- }
27
-
28
- const targetWindowId = this.getWindowId(targetWindow);
29
- this.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);
30
- this._onDidChangeZoomLevel.fire(targetWindowId);
31
- }
32
-
33
- // --- Zoom Factor
34
-
35
- private readonly mapWindowIdToZoomFactor = new Map<number, number>();
36
-
37
- getZoomFactor(targetWindow: Window): number {
38
- return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;
39
- }
40
- setZoomFactor(zoomFactor: number, targetWindow: Window): void {
41
- this.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);
42
- }
43
-
44
- // --- Fullscreen
45
-
46
- private readonly _onDidChangeFullscreen = new Emitter<number>();
47
- readonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;
48
-
49
- private readonly mapWindowIdToFullScreen = new Map<number, boolean>();
50
-
51
- setFullscreen(fullscreen: boolean, targetWindow: Window): void {
52
- if (this.isFullscreen(targetWindow) === fullscreen) {
53
- return;
54
- }
55
-
56
- const windowId = this.getWindowId(targetWindow);
57
- this.mapWindowIdToFullScreen.set(windowId, fullscreen);
58
- this._onDidChangeFullscreen.fire(windowId);
59
- }
60
- isFullscreen(targetWindow: Window): boolean {
61
- return !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));
62
- }
63
-
64
- private getWindowId(targetWindow: Window): number {
65
- return (targetWindow as CodeWindow).vscodeWindowId;
66
- }
67
- }
68
-
69
- export function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {
70
- if (typeof query === 'string') {
71
- query = targetWindow.matchMedia(query);
72
- }
73
- query.addEventListener('change', callback);
74
- }
75
-
76
- /** A zoom index, e.g. 1, 2, 3 */
77
- export function setZoomLevel(zoomLevel: number, targetWindow: Window): void {
78
- WindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);
79
- }
80
- export function getZoomLevel(targetWindow: Window): number {
81
- return WindowManager.INSTANCE.getZoomLevel(targetWindow);
82
- }
83
- export const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;
84
-
85
- /** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
86
- export function getZoomFactor(targetWindow: Window): number {
87
- return WindowManager.INSTANCE.getZoomFactor(targetWindow);
88
- }
89
- export function setZoomFactor(zoomFactor: number, targetWindow: Window): void {
90
- WindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);
91
- }
92
-
93
- export function setFullscreen(fullscreen: boolean, targetWindow: Window): void {
94
- WindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);
95
- }
96
- export function isFullscreen(targetWindow: Window): boolean {
97
- return WindowManager.INSTANCE.isFullscreen(targetWindow);
98
- }
99
- export const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;
100
-
101
- const userAgent = typeof navigator === 'object' ? navigator.userAgent : '';
102
-
103
- export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
104
- export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
105
- export const isChrome = (userAgent.indexOf('Chrome') >= 0);
106
- export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));
107
- export const isWebkitWebView = (!isChrome && !isSafari && isWebKit);
108
- export const isElectron = (userAgent.indexOf('Electron/') >= 0);
109
- export const isAndroid = (userAgent.indexOf('Android') >= 0);
110
-
111
- let standalone = false;
112
- if (typeof mainWindow.matchMedia === 'function') {
113
- const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');
114
- const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');
115
- standalone = standaloneMatchMedia.matches;
116
- addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {
117
- // entering fullscreen would change standaloneMatchMedia.matches to false
118
- // if standalone is true (running as PWA) and entering fullscreen, skip this change
119
- if (standalone && fullScreenMatchMedia.matches) {
120
- return;
121
- }
122
- // otherwise update standalone (browser to PWA or PWA to browser)
123
- standalone = matches;
124
- });
125
- }
126
- export function isStandalone(): boolean {
127
- return standalone;
128
- }
129
-
130
- // Visible means that the feature is enabled, not necessarily being rendered
131
- // e.g. visible is true even in fullscreen mode where the controls are hidden
132
- // See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible
133
- export function isWCOEnabled(): boolean {
134
- return (navigator as any)?.windowControlsOverlay?.visible;
135
- }
136
-
137
- // Returns the bounding rect of the titlebar area if it is supported and defined
138
- // See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect
139
- export function getWCOBoundingRect(): DOMRect | undefined {
140
- return (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();
141
- }