@xterm/xterm 6.1.0-beta.28 → 6.1.0-beta.280

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
@@ -3,12 +3,11 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { Disposable } from 'vs/base/common/lifecycle';
7
- import { IAttributeData } from 'common/Types';
8
- import { Buffer } from 'common/buffer/Buffer';
9
- import { IBuffer, IBufferSet } from 'common/buffer/Types';
10
- import { IBufferService, IOptionsService } from 'common/services/Services';
11
- import { Emitter } from 'vs/base/common/event';
6
+ import { Disposable, MutableDisposable } from '../Lifecycle';
7
+ import { Buffer } from './Buffer';
8
+ import { IAttributeData, IBuffer, IBufferSet } from './Types';
9
+ import { IBufferService, ILogService, IOptionsService } from '../services/Services';
10
+ import { Emitter } from '../Event';
12
11
 
13
12
  /**
14
13
  * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and
@@ -18,6 +17,8 @@ export class BufferSet extends Disposable implements IBufferSet {
18
17
  private _normal!: Buffer;
19
18
  private _alt!: Buffer;
20
19
  private _activeBuffer!: Buffer;
20
+ private readonly _normalBuffer = this._register(new MutableDisposable<Buffer>());
21
+ private readonly _altBuffer = this._register(new MutableDisposable<Buffer>());
21
22
 
22
23
  private readonly _onBufferActivate = this._register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());
23
24
  public readonly onBufferActivate = this._onBufferActivate.event;
@@ -27,7 +28,8 @@ export class BufferSet extends Disposable implements IBufferSet {
27
28
  */
28
29
  constructor(
29
30
  private readonly _optionsService: IOptionsService,
30
- private readonly _bufferService: IBufferService
31
+ private readonly _bufferService: IBufferService,
32
+ private readonly _logService: ILogService
31
33
  ) {
32
34
  super();
33
35
  this.reset();
@@ -36,12 +38,14 @@ export class BufferSet extends Disposable implements IBufferSet {
36
38
  }
37
39
 
38
40
  public reset(): void {
39
- this._normal = new Buffer(true, this._optionsService, this._bufferService);
41
+ this._normal = new Buffer(true, this._optionsService, this._bufferService, this._logService);
42
+ this._normalBuffer.value = this._normal;
40
43
  this._normal.fillViewportRows();
41
44
 
42
45
  // The alt buffer should never have scrollback.
43
46
  // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer
44
- this._alt = new Buffer(false, this._optionsService, this._bufferService);
47
+ this._alt = new Buffer(false, this._optionsService, this._bufferService, this._logService);
48
+ this._altBuffer.value = this._alt;
45
49
  this._activeBuffer = this._normal;
46
50
  this._onBufferActivate.fire({
47
51
  activeBuffer: this._normal,
@@ -3,10 +3,11 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { CharData, ICellData, IExtendedAttrs } from 'common/Types';
7
- import { stringFromCodePoint } from 'common/input/TextDecoder';
8
- import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';
9
- import { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';
6
+ import { CharData, ICellData, IExtendedAttrs } from './Types';
7
+ import { stringFromCodePoint } from '../input/TextDecoder';
8
+ import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
9
+ import { AttributeData, ExtendedAttrs } from './AttributeData';
10
+ import type { IBufferCell as IBufferCellApi } from '@xterm/xterm';
10
11
 
11
12
  /**
12
13
  * CellData - represents a single Cell in the terminal buffer.
@@ -91,4 +92,60 @@ export class CellData extends AttributeData implements ICellData {
91
92
  public getAsCharData(): CharData {
92
93
  return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
93
94
  }
95
+
96
+ public attributesEquals(other: IBufferCellApi): boolean {
97
+ if (this.getFgColorMode() !== other.getFgColorMode() || this.getFgColor() !== other.getFgColor()) {
98
+ return false;
99
+ }
100
+ if (this.getBgColorMode() !== other.getBgColorMode() || this.getBgColor() !== other.getBgColor()) {
101
+ return false;
102
+ }
103
+ if (this.isInverse() !== other.isInverse()) {
104
+ return false;
105
+ }
106
+ if (this.isBold() !== other.isBold()) {
107
+ return false;
108
+ }
109
+ if (this.isUnderline() !== other.isUnderline()) {
110
+ return false;
111
+ }
112
+ if (this.isUnderline()) {
113
+ if (this.getUnderlineStyle() !== other.getUnderlineStyle()) {
114
+ return false;
115
+ }
116
+ const thisDefault = this.isUnderlineColorDefault();
117
+ const otherDefault = other.isUnderlineColorDefault();
118
+ if (!(thisDefault && otherDefault)) {
119
+ if (thisDefault !== otherDefault) {
120
+ return false;
121
+ }
122
+ if (this.getUnderlineColor() !== other.getUnderlineColor()) {
123
+ return false;
124
+ }
125
+ if (this.getUnderlineColorMode() !== other.getUnderlineColorMode()) {
126
+ return false;
127
+ }
128
+ }
129
+ }
130
+ if (this.isOverline() !== other.isOverline()) {
131
+ return false;
132
+ }
133
+ if (this.isBlink() !== other.isBlink()) {
134
+ return false;
135
+ }
136
+ if (this.isInvisible() !== other.isInvisible()) {
137
+ return false;
138
+ }
139
+ if (this.isItalic() !== other.isItalic()) {
140
+ return false;
141
+ }
142
+ if (this.isDim() !== other.isDim()) {
143
+ return false;
144
+ }
145
+ if (this.isStrikethrough() !== other.isStrikethrough()) {
146
+ return false;
147
+ }
148
+ return true;
149
+ }
150
+
94
151
  }
@@ -24,7 +24,7 @@ export const NULL_CELL_CODE = 0;
24
24
  /**
25
25
  * Whitespace cell.
26
26
  * This is meant as a replacement for empty cells when needed
27
- * during rendering lines to preserve correct aligment.
27
+ * during rendering lines to preserve correct alignment.
28
28
  */
29
29
  export const WHITESPACE_CELL_CHAR = ' ';
30
30
  export const WHITESPACE_CELL_WIDTH = 1;
@@ -36,18 +36,18 @@ export const WHITESPACE_CELL_CODE = 32;
36
36
  export const enum Content {
37
37
  /**
38
38
  * bit 1..21 codepoint, max allowed in UTF32 is 0x10FFFF (21 bits taken)
39
- * read: `codepoint = content & Content.codepointMask;`
40
- * write: `content |= codepoint & Content.codepointMask;`
39
+ * read: `codepoint = content & Content.CODEPOINT_MASK;`
40
+ * write: `content |= codepoint & Content.CODEPOINT_MASK;`
41
41
  * shortcut if precondition `codepoint <= 0x10FFFF` is met:
42
42
  * `content |= codepoint;`
43
43
  */
44
44
  CODEPOINT_MASK = 0x1FFFFF,
45
45
 
46
46
  /**
47
- * bit 22 flag indication whether a cell contains combined content
48
- * read: `isCombined = content & Content.isCombined;`
49
- * set: `content |= Content.isCombined;`
50
- * clear: `content &= ~Content.isCombined;`
47
+ * bit 22 flag indicating whether a cell contains combined content
48
+ * read: `isCombined = content & Content.IS_COMBINED_MASK;`
49
+ * set: `content |= Content.IS_COMBINED_MASK;`
50
+ * clear: `content &= ~Content.IS_COMBINED_MASK;`
51
51
  */
52
52
  IS_COMBINED_MASK = 0x200000, // 1 << 21
53
53
 
@@ -55,19 +55,19 @@ export const enum Content {
55
55
  * bit 1..22 mask to check whether a cell contains any string data
56
56
  * we need to check for codepoint and isCombined bits to see
57
57
  * whether a cell contains anything
58
- * read: `isEmpty = !(content & Content.hasContent)`
58
+ * read: `isEmpty = !(content & Content.HAS_CONTENT_MASK)`
59
59
  */
60
60
  HAS_CONTENT_MASK = 0x3FFFFF,
61
61
 
62
62
  /**
63
63
  * bit 23..24 wcwidth value of cell, takes 2 bits (ranges from 0..2)
64
- * read: `width = (content & Content.widthMask) >> Content.widthShift;`
65
- * `hasWidth = content & Content.widthMask;`
64
+ * read: `width = (content & Content.WIDTH_MASK) >> Content.WIDTH_SHIFT;`
65
+ * `hasWidth = content & Content.WIDTH_MASK;`
66
66
  * as long as wcwidth is highest value in `content`:
67
- * `width = content >> Content.widthShift;`
68
- * write: `content |= (width << Content.widthShift) & Content.widthMask;`
67
+ * `width = content >> Content.WIDTH_SHIFT;`
68
+ * write: `content |= (width << Content.WIDTH_SHIFT) & Content.WIDTH_MASK;`
69
69
  * shortcut if precondition `0 <= width <= 3` is met:
70
- * `content |= width << Content.widthShift;`
70
+ * `content |= width << Content.WIDTH_SHIFT;`
71
71
  */
72
72
  WIDTH_MASK = 0xC00000, // 3 << 22
73
73
  WIDTH_SHIFT = 22
@@ -3,9 +3,9 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IDisposable, IMarker } from 'common/Types';
7
- import { Emitter } from 'vs/base/common/event';
8
- import { dispose } from 'vs/base/common/lifecycle';
6
+ import { dispose, IDisposable } from '../Lifecycle';
7
+ import { IMarker } from './Types';
8
+ import { Emitter } from '../Event';
9
9
 
10
10
  export class Marker implements IMarker {
11
11
  private static _nextId = 1;
@@ -30,7 +30,7 @@ export class Marker implements IMarker {
30
30
  }
31
31
  this.isDisposed = true;
32
32
  this.line = -1;
33
- // Emit before super.dispose such that dispose listeners get a change to react
33
+ // Emit before super.dispose such that dispose listeners get a chance to react
34
34
  this._onDispose.fire();
35
35
  dispose(this._disposables);
36
36
  this._disposables.length = 0;
@@ -3,12 +3,158 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/Types';
7
- import type { Event } from 'vs/base/common/event';
6
+ import type { IEvent } from '../Event';
7
+ import type { ICircularList } from '../CircularList';
8
+ import type { ICharset } from '../Types';
9
+ import type { IDisposable } from '../Lifecycle';
10
+ import type { UnderlineStyle } from './Constants';
8
11
 
9
12
  // BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
10
13
  export type BufferIndex = [number, number];
11
14
 
15
+ export type CharData = [attr: number, char: string, width: number, code: number];
16
+
17
+ export interface IExtendedAttrs {
18
+ ext: number;
19
+ underlineStyle: UnderlineStyle;
20
+ underlineColor: number;
21
+ underlineVariantOffset: number;
22
+ urlId: number;
23
+ clone(): IExtendedAttrs;
24
+ isEmpty(): boolean;
25
+ }
26
+
27
+ /**
28
+ * An object that represents all attributes of a cell.
29
+ */
30
+ export interface IAttributeData {
31
+ /**
32
+ * "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
33
+ * significant bits and additional flags in the remaining 8 bits.
34
+ */
35
+ fg: number;
36
+ /**
37
+ * "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
38
+ * significant bits and additional flags in the remaining 8 bits.
39
+ */
40
+ bg: number;
41
+ /**
42
+ * "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
43
+ * data is optional on a cell and encodes less common data.
44
+ */
45
+ extended: IExtendedAttrs;
46
+
47
+ clone(): IAttributeData;
48
+
49
+ // flags
50
+ isInverse(): number;
51
+ isBold(): number;
52
+ isUnderline(): number;
53
+ isBlink(): number;
54
+ isInvisible(): number;
55
+ isItalic(): number;
56
+ isDim(): number;
57
+ isStrikethrough(): number;
58
+ isProtected(): number;
59
+ isOverline(): number;
60
+
61
+ /**
62
+ * The color mode of the foreground color which determines how to decode {@link getFgColor},
63
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
64
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
65
+ */
66
+ getFgColorMode(): number;
67
+ /**
68
+ * The color mode of the background color which determines how to decode {@link getBgColor},
69
+ * possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
70
+ * {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
71
+ */
72
+ getBgColorMode(): number;
73
+ isFgRGB(): boolean;
74
+ isBgRGB(): boolean;
75
+ isFgPalette(): boolean;
76
+ isBgPalette(): boolean;
77
+ isFgDefault(): boolean;
78
+ isBgDefault(): boolean;
79
+ isAttributeDefault(): boolean;
80
+
81
+ /**
82
+ * Gets an integer representation of the foreground color, how to decode the color depends on the
83
+ * color mode {@link getFgColorMode}.
84
+ */
85
+ getFgColor(): number;
86
+ /**
87
+ * Gets an integer representation of the background color, how to decode the color depends on the
88
+ * color mode {@link getBgColorMode}.
89
+ */
90
+ getBgColor(): number;
91
+
92
+ // extended attrs
93
+ hasExtendedAttrs(): number;
94
+ updateExtended(): void;
95
+ getUnderlineColor(): number;
96
+ getUnderlineColorMode(): number;
97
+ isUnderlineColorRGB(): boolean;
98
+ isUnderlineColorPalette(): boolean;
99
+ isUnderlineColorDefault(): boolean;
100
+ getUnderlineStyle(): number;
101
+ getUnderlineVariantOffset(): number;
102
+ }
103
+
104
+ /** Cell data */
105
+ export interface ICellData extends IAttributeData {
106
+ content: number;
107
+ combinedData: string;
108
+ isCombined(): number;
109
+ getWidth(): number;
110
+ getChars(): string;
111
+ getCode(): number;
112
+ setFromCharData(value: CharData): void;
113
+ getAsCharData(): CharData;
114
+ }
115
+
116
+ /**
117
+ * Interface for a line in the terminal buffer.
118
+ */
119
+ export interface IBufferLine {
120
+ length: number;
121
+ isWrapped: boolean;
122
+ get(index: number): CharData;
123
+ set(index: number, value: CharData): void;
124
+ loadCell(index: number, cell: ICellData): ICellData;
125
+ setCell(index: number, cell: ICellData): void;
126
+ setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
127
+ addCodepointToCell(index: number, codePoint: number, width: number): void;
128
+ insertCells(pos: number, n: number, ch: ICellData): void;
129
+ deleteCells(pos: number, n: number, fill: ICellData): void;
130
+ replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
131
+ resize(cols: number, fill: ICellData): boolean;
132
+ cleanupMemory(): number;
133
+ fill(fillCellData: ICellData, respectProtect?: boolean): void;
134
+ copyFrom(line: IBufferLine): void;
135
+ clone(): IBufferLine;
136
+ getTrimmedLength(): number;
137
+ getNoBgTrimmedLength(): number;
138
+ translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
139
+
140
+ /* direct access to cell attrs */
141
+ getWidth(index: number): number;
142
+ hasWidth(index: number): number;
143
+ getFg(index: number): number;
144
+ getBg(index: number): number;
145
+ hasContent(index: number): number;
146
+ getCodePoint(index: number): number;
147
+ isCombined(index: number): number;
148
+ getString(index: number): string;
149
+ }
150
+
151
+ export interface IMarker extends IDisposable {
152
+ readonly id: number;
153
+ readonly isDisposed: boolean;
154
+ readonly line: number;
155
+ onDispose: IEvent<void>;
156
+ }
157
+
12
158
  export interface IBuffer {
13
159
  readonly lines: ICircularList<IBufferLine>;
14
160
  ydisp: number;
@@ -22,6 +168,10 @@ export interface IBuffer {
22
168
  savedY: number;
23
169
  savedX: number;
24
170
  savedCharset: ICharset | undefined;
171
+ savedCharsets: (ICharset | undefined)[];
172
+ savedGlevel: number;
173
+ savedOriginMode: boolean;
174
+ savedWraparoundMode: boolean;
25
175
  savedCurAttrData: IAttributeData;
26
176
  isCursorInViewport: boolean;
27
177
  markers: IMarker[];
@@ -42,7 +192,7 @@ export interface IBufferSet extends IDisposable {
42
192
  normal: IBuffer;
43
193
  active: IBuffer;
44
194
 
45
- onBufferActivate: Event<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
195
+ onBufferActivate: IEvent<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>;
46
196
 
47
197
  activateNormalBuffer(): void;
48
198
  activateAltBuffer(fillAttr?: IAttributeData): void;
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- import { ICharset } from 'common/Types';
6
+ import { ICharset } from '../Types';
7
7
 
8
8
  /**
9
9
  * The character sets supported by the terminal. These enable several languages
@@ -98,8 +98,7 @@ CHARSETS['4'] = {
98
98
  * ESC (C or ESC (5
99
99
  * Reference: http://vt100.net/docs/vt220-rm/table2-7.html
100
100
  */
101
- CHARSETS['C'] =
102
- CHARSETS['5'] = {
101
+ CHARSETS['C'] = CHARSETS['5'] = {
103
102
  '[': 'Ä',
104
103
  '\\': 'Ö',
105
104
  ']': 'Å',
@@ -185,8 +184,7 @@ CHARSETS['Y'] = {
185
184
  * ESC (E or ESC (6
186
185
  * Reference: http://vt100.net/docs/vt220-rm/table2-12.html
187
186
  */
188
- CHARSETS['E'] =
189
- CHARSETS['6'] = {
187
+ CHARSETS['E'] = CHARSETS['6'] = {
190
188
  '@': 'Ä',
191
189
  '[': 'Æ',
192
190
  '\\': 'Ø',
@@ -220,8 +218,7 @@ CHARSETS['Z'] = {
220
218
  * ESC (H or ESC (7
221
219
  * Reference: http://vt100.net/docs/vt220-rm/table2-14.html
222
220
  */
223
- CHARSETS['H'] =
224
- CHARSETS['7'] = {
221
+ CHARSETS['H'] = CHARSETS['7'] = {
225
222
  '@': 'É',
226
223
  '[': 'Ä',
227
224
  '\\': 'Ö',
@@ -7,147 +7,148 @@
7
7
  * C0 control codes
8
8
  * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes
9
9
  */
10
- export namespace C0 {
10
+ export const enum C0 {
11
11
  /** Null (Caret = ^@, C = \0) */
12
- export const NUL = '\x00';
12
+ NUL = '\x00',
13
13
  /** Start of Heading (Caret = ^A) */
14
- export const SOH = '\x01';
14
+ SOH = '\x01',
15
15
  /** Start of Text (Caret = ^B) */
16
- export const STX = '\x02';
16
+ STX = '\x02',
17
17
  /** End of Text (Caret = ^C) */
18
- export const ETX = '\x03';
18
+ ETX = '\x03',
19
19
  /** End of Transmission (Caret = ^D) */
20
- export const EOT = '\x04';
20
+ EOT = '\x04',
21
21
  /** Enquiry (Caret = ^E) */
22
- export const ENQ = '\x05';
22
+ ENQ = '\x05',
23
23
  /** Acknowledge (Caret = ^F) */
24
- export const ACK = '\x06';
24
+ ACK = '\x06',
25
25
  /** Bell (Caret = ^G, C = \a) */
26
- export const BEL = '\x07';
26
+ BEL = '\x07',
27
27
  /** Backspace (Caret = ^H, C = \b) */
28
- export const BS = '\x08';
28
+ BS = '\x08',
29
29
  /** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \t) */
30
- export const HT = '\x09';
30
+ HT = '\x09',
31
31
  /** Line Feed (Caret = ^J, C = \n) */
32
- export const LF = '\x0a';
32
+ LF = '\x0a',
33
33
  /** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \v) */
34
- export const VT = '\x0b';
34
+ VT = '\x0b',
35
35
  /** Form Feed (Caret = ^L, C = \f) */
36
- export const FF = '\x0c';
36
+ FF = '\x0c',
37
37
  /** Carriage Return (Caret = ^M, C = \r) */
38
- export const CR = '\x0d';
38
+ CR = '\x0d',
39
39
  /** Shift Out (Caret = ^N) */
40
- export const SO = '\x0e';
40
+ SO = '\x0e',
41
41
  /** Shift In (Caret = ^O) */
42
- export const SI = '\x0f';
42
+ SI = '\x0f',
43
43
  /** Data Link Escape (Caret = ^P) */
44
- export const DLE = '\x10';
44
+ DLE = '\x10',
45
45
  /** Device Control One (XON) (Caret = ^Q) */
46
- export const DC1 = '\x11';
46
+ DC1 = '\x11',
47
47
  /** Device Control Two (Caret = ^R) */
48
- export const DC2 = '\x12';
48
+ DC2 = '\x12',
49
49
  /** Device Control Three (XOFF) (Caret = ^S) */
50
- export const DC3 = '\x13';
50
+ DC3 = '\x13',
51
51
  /** Device Control Four (Caret = ^T) */
52
- export const DC4 = '\x14';
52
+ DC4 = '\x14',
53
53
  /** Negative Acknowledge (Caret = ^U) */
54
- export const NAK = '\x15';
54
+ NAK = '\x15',
55
55
  /** Synchronous Idle (Caret = ^V) */
56
- export const SYN = '\x16';
56
+ SYN = '\x16',
57
57
  /** End of Transmission Block (Caret = ^W) */
58
- export const ETB = '\x17';
58
+ ETB = '\x17',
59
59
  /** Cancel (Caret = ^X) */
60
- export const CAN = '\x18';
60
+ CAN = '\x18',
61
61
  /** End of Medium (Caret = ^Y) */
62
- export const EM = '\x19';
62
+ EM = '\x19',
63
63
  /** Substitute (Caret = ^Z) */
64
- export const SUB = '\x1a';
64
+ SUB = '\x1a',
65
65
  /** Escape (Caret = ^[, C = \e) */
66
- export const ESC = '\x1b';
66
+ ESC = '\x1b',
67
67
  /** File Separator (Caret = ^\) */
68
- export const FS = '\x1c';
68
+ FS = '\x1c',
69
69
  /** Group Separator (Caret = ^]) */
70
- export const GS = '\x1d';
70
+ GS = '\x1d',
71
71
  /** Record Separator (Caret = ^^) */
72
- export const RS = '\x1e';
72
+ RS = '\x1e',
73
73
  /** Unit Separator (Caret = ^_) */
74
- export const US = '\x1f';
74
+ US = '\x1f',
75
75
  /** Space */
76
- export const SP = '\x20';
76
+ SP = '\x20',
77
77
  /** Delete (Caret = ^?) */
78
- export const DEL = '\x7f';
78
+ DEL = '\x7f'
79
79
  }
80
80
 
81
81
  /**
82
82
  * C1 control codes
83
83
  * See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes
84
84
  */
85
- export namespace C1 {
85
+ export const enum C1 {
86
86
  /** padding character */
87
- export const PAD = '\x80';
87
+ PAD = '\x80',
88
88
  /** High Octet Preset */
89
- export const HOP = '\x81';
89
+ HOP = '\x81',
90
90
  /** Break Permitted Here */
91
- export const BPH = '\x82';
91
+ BPH = '\x82',
92
92
  /** No Break Here */
93
- export const NBH = '\x83';
93
+ NBH = '\x83',
94
94
  /** Index */
95
- export const IND = '\x84';
95
+ IND = '\x84',
96
96
  /** Next Line */
97
- export const NEL = '\x85';
97
+ NEL = '\x85',
98
98
  /** Start of Selected Area */
99
- export const SSA = '\x86';
99
+ SSA = '\x86',
100
100
  /** End of Selected Area */
101
- export const ESA = '\x87';
101
+ ESA = '\x87',
102
102
  /** Horizontal Tabulation Set */
103
- export const HTS = '\x88';
103
+ HTS = '\x88',
104
104
  /** Horizontal Tabulation With Justification */
105
- export const HTJ = '\x89';
105
+ HTJ = '\x89',
106
106
  /** Vertical Tabulation Set */
107
- export const VTS = '\x8a';
107
+ VTS = '\x8a',
108
108
  /** Partial Line Down */
109
- export const PLD = '\x8b';
109
+ PLD = '\x8b',
110
110
  /** Partial Line Up */
111
- export const PLU = '\x8c';
111
+ PLU = '\x8c',
112
112
  /** Reverse Index */
113
- export const RI = '\x8d';
113
+ RI = '\x8d',
114
114
  /** Single-Shift 2 */
115
- export const SS2 = '\x8e';
115
+ SS2 = '\x8e',
116
116
  /** Single-Shift 3 */
117
- export const SS3 = '\x8f';
117
+ SS3 = '\x8f',
118
118
  /** Device Control String */
119
- export const DCS = '\x90';
119
+ DCS = '\x90',
120
120
  /** Private Use 1 */
121
- export const PU1 = '\x91';
121
+ PU1 = '\x91',
122
122
  /** Private Use 2 */
123
- export const PU2 = '\x92';
123
+ PU2 = '\x92',
124
124
  /** Set Transmit State */
125
- export const STS = '\x93';
125
+ STS = '\x93',
126
126
  /** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */
127
- export const CCH = '\x94';
127
+ CCH = '\x94',
128
128
  /** Message Waiting */
129
- export const MW = '\x95';
129
+ MW = '\x95',
130
130
  /** Start of Protected Area */
131
- export const SPA = '\x96';
131
+ SPA = '\x96',
132
132
  /** End of Protected Area */
133
- export const EPA = '\x97';
133
+ EPA = '\x97',
134
134
  /** Start of String */
135
- export const SOS = '\x98';
135
+ SOS = '\x98',
136
136
  /** Single Graphic Character Introducer */
137
- export const SGCI = '\x99';
137
+ SGCI = '\x99',
138
138
  /** Single Character Introducer */
139
- export const SCI = '\x9a';
139
+ SCI = '\x9a',
140
140
  /** Control Sequence Introducer */
141
- export const CSI = '\x9b';
141
+ CSI = '\x9b',
142
142
  /** String Terminator */
143
- export const ST = '\x9c';
143
+ ST = '\x9c',
144
144
  /** Operating System Command */
145
- export const OSC = '\x9d';
145
+ OSC = '\x9d',
146
146
  /** Privacy Message */
147
- export const PM = '\x9e';
147
+ PM = '\x9e',
148
148
  /** Application Program Command */
149
- export const APC = '\x9f';
149
+ APC = '\x9f'
150
150
  }
151
- export namespace C1_ESCAPED {
152
- export const ST = `${C0.ESC}\\`;
151
+
152
+ export const enum C1ESCAPED {
153
+ ST = '\x1b\\'
153
154
  }