@xterm/xterm 6.1.0-beta.9 → 6.1.0-beta.90

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 (36) hide show
  1. package/README.md +27 -28
  2. package/css/xterm.css +5 -11
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +17 -17
  6. package/lib/xterm.mjs.map +4 -4
  7. package/package.json +26 -19
  8. package/src/browser/AccessibilityManager.ts +4 -1
  9. package/src/browser/CoreBrowserTerminal.ts +37 -6
  10. package/src/browser/OscLinkProvider.ts +1 -1
  11. package/src/browser/Types.ts +4 -1
  12. package/src/browser/Viewport.ts +16 -1
  13. package/src/browser/input/CompositionHelper.ts +10 -1
  14. package/src/browser/public/Terminal.ts +6 -5
  15. package/src/browser/renderer/dom/DomRenderer.ts +74 -3
  16. package/src/browser/renderer/dom/WidthCache.ts +54 -52
  17. package/src/browser/renderer/shared/Constants.ts +7 -0
  18. package/src/browser/renderer/shared/Types.ts +5 -0
  19. package/src/browser/services/MouseService.ts +2 -1
  20. package/src/browser/services/RenderService.ts +9 -5
  21. package/src/browser/services/Services.ts +1 -1
  22. package/src/common/Color.ts +8 -0
  23. package/src/common/CoreTerminal.ts +2 -1
  24. package/src/common/InputHandler.ts +52 -9
  25. package/src/common/Platform.ts +4 -1
  26. package/src/common/Types.ts +1 -1
  27. package/src/common/Version.ts +9 -0
  28. package/src/common/buffer/Buffer.ts +4 -0
  29. package/src/common/buffer/Types.ts +4 -0
  30. package/src/common/data/Charsets.ts +1 -1
  31. package/src/common/input/Keyboard.ts +7 -6
  32. package/src/common/services/CharsetService.ts +4 -0
  33. package/src/common/services/DecorationService.ts +17 -3
  34. package/src/common/services/OptionsService.ts +2 -2
  35. package/src/common/services/Services.ts +6 -1
  36. package/typings/xterm.d.ts +165 -34
@@ -58,7 +58,9 @@ 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
 
@@ -77,22 +79,6 @@ declare module '@xterm/xterm' {
77
79
  */
78
80
  cursorInactiveStyle?: 'outline' | 'block' | 'bar' | 'underline' | 'none';
79
81
 
80
- /**
81
- * Whether to draw custom glyphs instead of using the font for the following
82
- * unicode ranges:
83
- *
84
- * - Box Drawing (U+2500-U+257F)
85
- * - Box Elements (U+2580-U+259F)
86
- * - Powerline Symbols (U+E0A0–U+E0BF)
87
- * - Symbols for Legacy Computing (U+1FB00–U+1FBFF)
88
- *
89
- * This will typically result in better rendering with continuous lines,
90
- * even when line height and letter spacing is used. Note that this doesn't
91
- * work with the DOM renderer which renders all characters using the font.
92
- * The default is true.
93
- */
94
- customGlyphs?: boolean;
95
-
96
82
  /**
97
83
  * Whether input should be disabled.
98
84
  */
@@ -213,10 +199,17 @@ declare module '@xterm/xterm' {
213
199
  */
214
200
  minimumContrastRatio?: number;
215
201
 
202
+ /**
203
+ * Control various quirks features that are either non-standard or standard
204
+ * in but generally rejected in modern terminals.
205
+ */
206
+ quirks?: ITerminalQuirks;
207
+
216
208
  /**
217
209
  * Whether to reflow the line containing the cursor when the terminal is
218
210
  * resized. Defaults to false, because shells usually handle this
219
- * themselves.
211
+ * themselves. Note that this will not move the cursor position, only the
212
+ * line contents.
220
213
  */
221
214
  reflowCursorLine?: boolean;
222
215
 
@@ -367,17 +360,17 @@ declare module '@xterm/xterm' {
367
360
  selectionInactiveBackground?: string;
368
361
  /**
369
362
  * The scrollbar slider background color. Defaults to
370
- * {@link ITerminalOptions.foreground foreground} with 20% opacity.
363
+ * {@link ITheme.foreground} with 20% opacity.
371
364
  */
372
365
  scrollbarSliderBackground?: string;
373
366
  /**
374
367
  * The scrollbar slider background color when hovered. Defaults to
375
- * {@link ITerminalOptions.foreground foreground} with 40% opacity.
368
+ * {@link ITheme.foreground} with 40% opacity.
376
369
  */
377
370
  scrollbarSliderHoverBackground?: string;
378
371
  /**
379
372
  * The scrollbar slider background color when clicked. Defaults to
380
- * {@link ITerminalOptions.foreground foreground} with 50% opacity.
373
+ * {@link ITheme.foreground} with 50% opacity.
381
374
  */
382
375
  scrollbarSliderActiveBackground?: string;
383
376
  /**
@@ -422,6 +415,21 @@ declare module '@xterm/xterm' {
422
415
  extendedAnsi?: string[];
423
416
  }
424
417
 
418
+ /**
419
+ * Control various quirks features that are either non-standard or standard
420
+ * in but generally rejected in modern terminals.
421
+ */
422
+ export interface ITerminalQuirks {
423
+ /**
424
+ * Enables support for DECSET 12 and DECRST 12 which controls cursor blink.
425
+ * Programs such as `vim` may use this to set the cursor blink state but may
426
+ * not change it back when exiting. Generally the terminal emulator should
427
+ * be in control of whether the cursor blinks or not and the application in
428
+ * modern terminals. Note that DECRQM works regardless of this option.
429
+ */
430
+ allowSetCursorBlink?: boolean;
431
+ }
432
+
425
433
  /**
426
434
  * Pty information for Windows.
427
435
  */
@@ -848,8 +856,8 @@ declare module '@xterm/xterm' {
848
856
  readonly buffer: IBufferNamespace;
849
857
 
850
858
  /**
851
- * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
852
- * buffer is active this will always return [].
859
+ * Get all markers registered against the buffer. If the alt buffer is
860
+ * active this will always return [].
853
861
  */
854
862
  readonly markers: ReadonlyArray<IMarker>;
855
863
 
@@ -859,8 +867,8 @@ declare module '@xterm/xterm' {
859
867
  readonly parser: IParser;
860
868
 
861
869
  /**
862
- * (EXPERIMENTAL) Get the Unicode handling interface
863
- * to register and switch Unicode version.
870
+ * (EXPERIMENTAL) Get the Unicode handling interface to register and switch
871
+ * Unicode version.
864
872
  */
865
873
  readonly unicode: IUnicodeHandling;
866
874
 
@@ -869,6 +877,12 @@ declare module '@xterm/xterm' {
869
877
  */
870
878
  readonly modes: IModes;
871
879
 
880
+ /**
881
+ * The dimensions of the terminal. This will be undefined before
882
+ * {@link open} is called.
883
+ */
884
+ readonly dimensions: IRenderDimensions | undefined;
885
+
872
886
  /**
873
887
  * Gets or sets the terminal options. This supports setting multiple
874
888
  * options.
@@ -1009,6 +1023,12 @@ declare module '@xterm/xterm' {
1009
1023
  */
1010
1024
  onTitleChange: IEvent<string>;
1011
1025
 
1026
+ /**
1027
+ * Adds an event listener for when the terminal's dimensions change.
1028
+ * @returns an `IDisposable` to stop listening.
1029
+ */
1030
+ onDimensionsChange: IEvent<IRenderDimensions>;
1031
+
1012
1032
  /**
1013
1033
  * Unfocus the terminal.
1014
1034
  */
@@ -1109,9 +1129,9 @@ declare module '@xterm/xterm' {
1109
1129
  registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
1110
1130
 
1111
1131
  /**
1112
- * (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
1113
- * characters to be rendered as a single unit. This is useful in particular
1114
- * for rendering ligatures and graphemes, among other things.
1132
+ * Registers a character joiner, allowing custom sequences of characters to
1133
+ * be rendered as a single unit. This is useful in particular for rendering
1134
+ * ligatures and graphemes, among other things.
1115
1135
  *
1116
1136
  * Each registered character joiner is called with a string of text
1117
1137
  * representing a portion of a line in the terminal that can be rendered as
@@ -1129,8 +1149,6 @@ declare module '@xterm/xterm' {
1129
1149
  * render together, since they aren't drawn as optimally as individual
1130
1150
  * characters.
1131
1151
  *
1132
- * NOTE: character joiners are only used by the webgl renderer.
1133
- *
1134
1152
  * @param handler The function that determines character joins. It is called
1135
1153
  * with a string of text that is eligible for joining and returns an array
1136
1154
  * where each entry is an array containing the start (inclusive) and end
@@ -1140,8 +1158,8 @@ declare module '@xterm/xterm' {
1140
1158
  registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
1141
1159
 
1142
1160
  /**
1143
- * (EXPERIMENTAL) Deregisters the character joiner if one was registered.
1144
- * NOTE: character joiners are only used by the webgl renderer.
1161
+ * Deregisters the character joiner if one was registered. Note that
1162
+ * character joiners are only used by the webgl renderer.
1145
1163
  * @param joinerId The character joiner's ID (returned after register)
1146
1164
  */
1147
1165
  deregisterCharacterJoiner(joinerId: number): void;
@@ -1154,7 +1172,7 @@ declare module '@xterm/xterm' {
1154
1172
  registerMarker(cursorYOffset?: number): IMarker;
1155
1173
 
1156
1174
  /**
1157
- * (EXPERIMENTAL) Adds a decoration to the terminal using
1175
+ * Registers a decoration to the terminal.
1158
1176
  * @param decorationOptions, which takes a marker and an optional anchor,
1159
1177
  * width, height, and x offset from the anchor. Returns the decoration or
1160
1178
  * undefined if the alt buffer is active or the marker has already been
@@ -1846,7 +1864,7 @@ declare module '@xterm/xterm' {
1846
1864
  * @param id Specifies the function identifier under which the callback gets
1847
1865
  * registered, e.g. {intermediates: '%' final: 'G'} for default charset
1848
1866
  * selection.
1849
- * @param callback The function to handle the sequence.
1867
+ * @param handler The function to handle the sequence.
1850
1868
  * Return `true` if the sequence was handled, `false` if the parser should
1851
1869
  * try a previous handler. The most recently added handler is tried first.
1852
1870
  * @returns An IDisposable you can call to remove this handler.
@@ -1949,6 +1967,10 @@ declare module '@xterm/xterm' {
1949
1967
  * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1950
1968
  */
1951
1969
  readonly sendFocusMode: boolean;
1970
+ /**
1971
+ * Show Cursor (DECTCEM): `CSI ? 2 5 h`
1972
+ */
1973
+ readonly showCursor: boolean;
1952
1974
  /**
1953
1975
  * Synchronized Output Mode: `CSI ? 2 0 2 6 h`
1954
1976
  *
@@ -1961,4 +1983,113 @@ declare module '@xterm/xterm' {
1961
1983
  */
1962
1984
  readonly wraparoundMode: boolean;
1963
1985
  }
1986
+
1987
+ /**
1988
+ * An object containing a width and height in pixels.
1989
+ */
1990
+ export interface IDimensions {
1991
+ width: number;
1992
+ height: number;
1993
+ }
1994
+
1995
+ /**
1996
+ * An object containing a top and left offset.
1997
+ */
1998
+ export interface IOffset {
1999
+ top: number;
2000
+ left: number;
2001
+ }
2002
+
2003
+ /**
2004
+ * The dimensions of the terminal.
2005
+ */
2006
+ export interface IRenderDimensions {
2007
+ /**
2008
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2009
+ * ratio).
2010
+ */
2011
+ css: {
2012
+ /**
2013
+ * The dimensions of the canvas.
2014
+ */
2015
+ canvas: IDimensions;
2016
+ /**
2017
+ * The dimensions of a single cell.
2018
+ */
2019
+ cell: IDimensions;
2020
+ };
2021
+ /**
2022
+ * Dimensions measured in actual pixels as rendered to the device.
2023
+ */
2024
+ device: {
2025
+ /**
2026
+ * The dimensions of the canvas.
2027
+ */
2028
+ canvas: IDimensions;
2029
+ /**
2030
+ * The dimensions of a single cell.
2031
+ */
2032
+ cell: IDimensions;
2033
+ /**
2034
+ * The dimensions of a single character within a cell, including its
2035
+ * offset within the cell.
2036
+ */
2037
+ char: IDimensions & IOffset;
2038
+ };
2039
+ }
2040
+
2041
+ /**
2042
+ * An object containing a width and height in pixels.
2043
+ */
2044
+ export interface IDimensions {
2045
+ width: number;
2046
+ height: number;
2047
+ }
2048
+
2049
+ /**
2050
+ * An object containing a top and left offset.
2051
+ */
2052
+ export interface IOffset {
2053
+ top: number;
2054
+ left: number;
2055
+ }
2056
+
2057
+ /**
2058
+ * The dimensions of the terminal, this is constructed and available after
2059
+ * {@link Terminal.open} is called.
2060
+ */
2061
+ export interface IRenderDimensions {
2062
+ /**
2063
+ * Dimensions measured in CSS pixels (ie. device pixels / device pixel
2064
+ * ratio).
2065
+ */
2066
+ css: {
2067
+ /**
2068
+ * The dimensions of the canvas which is the full terminal size.
2069
+ */
2070
+ canvas: IDimensions;
2071
+ /**
2072
+ * The dimensions of a single cell.
2073
+ */
2074
+ cell: IDimensions;
2075
+ };
2076
+ /**
2077
+ * Dimensions measured in actual pixels as rendered to the device.
2078
+ */
2079
+ device: {
2080
+ /**
2081
+ * The dimensions of the canvas which is the full terminal size.
2082
+ */
2083
+ canvas: IDimensions;
2084
+ /**
2085
+ * The dimensions of a single cell.
2086
+ */
2087
+ cell: IDimensions;
2088
+ /**
2089
+ * The dimensions of a single character within a cell, including its
2090
+ * offset within the cell.
2091
+ */
2092
+ char: IDimensions & IOffset;
2093
+ };
2094
+ }
1964
2095
  }