@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.
- package/README.md +62 -38
- package/css/xterm.css +29 -22
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +8 -34
- package/lib/xterm.mjs.map +4 -4
- package/package.json +56 -45
- package/src/browser/AccessibilityManager.ts +18 -13
- package/src/browser/Clipboard.ts +8 -5
- package/src/browser/ColorContrastCache.ts +3 -3
- package/src/browser/CoreBrowserTerminal.ts +179 -348
- package/src/browser/Dom.ts +178 -0
- package/src/browser/Linkifier.ts +14 -14
- package/src/browser/OscLinkProvider.ts +86 -18
- package/src/browser/RenderDebouncer.ts +7 -9
- package/src/browser/TimeBasedDebouncer.ts +12 -5
- package/src/browser/Types.ts +16 -14
- package/src/browser/Viewport.ts +58 -23
- package/src/browser/decorations/BufferDecorationRenderer.ts +3 -3
- package/src/browser/decorations/ColorZoneStore.ts +1 -1
- package/src/browser/decorations/OverviewRulerRenderer.ts +36 -20
- package/src/browser/input/CompositionHelper.ts +47 -11
- package/src/browser/input/Mouse.ts +5 -9
- package/src/browser/input/MoveToCell.ts +3 -3
- package/src/browser/public/Terminal.ts +33 -36
- package/src/browser/renderer/dom/DomRenderer.ts +265 -89
- package/src/browser/renderer/dom/DomRendererRowFactory.ts +34 -27
- package/src/browser/renderer/dom/WidthCache.ts +57 -55
- package/src/browser/renderer/shared/Constants.ts +7 -0
- package/src/browser/renderer/shared/RendererUtils.ts +1 -1
- package/src/browser/renderer/shared/SelectionRenderModel.ts +2 -2
- package/src/browser/renderer/shared/TextBlinkStateManager.ts +97 -0
- package/src/browser/renderer/shared/Types.ts +10 -4
- package/src/browser/scrollable/abstractScrollbar.ts +300 -0
- package/src/browser/scrollable/fastDomNode.ts +126 -0
- package/src/browser/scrollable/globalPointerMoveMonitor.ts +90 -0
- package/src/browser/scrollable/horizontalScrollbar.ts +85 -0
- package/src/browser/scrollable/mouseEvent.ts +292 -0
- package/src/browser/scrollable/scrollable.ts +486 -0
- package/src/browser/scrollable/scrollableElement.ts +581 -0
- package/src/browser/scrollable/scrollableElementOptions.ts +161 -0
- package/src/browser/scrollable/scrollbarArrow.ts +110 -0
- package/src/browser/scrollable/scrollbarState.ts +246 -0
- package/src/browser/scrollable/scrollbarVisibilityController.ts +113 -0
- package/src/browser/scrollable/touch.ts +485 -0
- package/src/browser/scrollable/verticalScrollbar.ts +143 -0
- package/src/browser/scrollable/widget.ts +23 -0
- package/src/browser/selection/SelectionModel.ts +1 -1
- package/src/browser/services/CharSizeService.ts +4 -4
- package/src/browser/services/CharacterJoinerService.ts +13 -11
- package/src/browser/services/CoreBrowserService.ts +7 -5
- package/src/browser/services/KeyboardService.ts +67 -0
- package/src/browser/services/LinkProviderService.ts +3 -3
- package/src/browser/services/MouseCoordsService.ts +47 -0
- package/src/browser/services/MouseService.ts +619 -23
- package/src/browser/services/RenderService.ts +33 -21
- package/src/browser/services/SelectionService.ts +72 -54
- package/src/browser/services/Services.ts +44 -21
- package/src/browser/services/ThemeService.ts +9 -9
- package/src/common/Async.ts +141 -0
- package/src/common/CircularList.ts +24 -3
- package/src/common/Color.ts +13 -5
- package/src/common/CoreTerminal.ts +61 -35
- package/src/common/Event.ts +118 -0
- package/src/common/InputHandler.ts +286 -105
- package/src/common/Lifecycle.ts +113 -0
- package/src/common/Platform.ts +15 -5
- package/src/common/SortedList.ts +8 -4
- package/src/common/StringBuilder.ts +67 -0
- package/src/common/TaskQueue.ts +17 -8
- package/src/common/Types.ts +68 -206
- package/src/common/Version.ts +1 -1
- package/src/common/WindowsMode.ts +2 -2
- package/src/common/buffer/AttributeData.ts +3 -2
- package/src/common/buffer/Buffer.ts +47 -32
- package/src/common/buffer/BufferLine.ts +175 -100
- package/src/common/buffer/BufferLineStringCache.ts +69 -0
- package/src/common/buffer/BufferReflow.ts +7 -4
- package/src/common/buffer/BufferSet.ts +13 -9
- package/src/common/buffer/CellData.ts +61 -4
- package/src/common/buffer/Constants.ts +13 -13
- package/src/common/buffer/Marker.ts +4 -4
- package/src/common/buffer/Types.ts +153 -3
- package/src/common/data/Charsets.ts +4 -7
- package/src/common/data/EscapeSequences.ts +71 -70
- package/src/common/input/Keyboard.ts +17 -10
- package/src/common/input/KittyKeyboard.ts +526 -0
- package/src/common/input/TextDecoder.ts +3 -3
- package/src/common/input/UnicodeV6.ts +3 -2
- package/src/common/input/Win32InputMode.ts +297 -0
- package/src/common/input/WriteBuffer.ts +108 -39
- package/src/common/input/XParseColor.ts +2 -2
- package/src/common/parser/ApcParser.ts +196 -0
- package/src/common/parser/Constants.ts +14 -4
- package/src/common/parser/DcsParser.ts +15 -16
- package/src/common/parser/EscapeSequenceParser.ts +214 -72
- package/src/common/parser/OscParser.ts +14 -15
- package/src/common/parser/Params.ts +31 -12
- package/src/common/parser/Types.ts +40 -30
- package/src/common/public/BufferApiView.ts +3 -3
- package/src/common/public/BufferLineApiView.ts +4 -4
- package/src/common/public/BufferNamespaceApi.ts +5 -5
- package/src/common/public/ParserApi.ts +5 -2
- package/src/common/public/UnicodeApi.ts +1 -1
- package/src/common/services/BufferService.ts +17 -13
- package/src/common/services/CharsetService.ts +6 -2
- package/src/common/services/CoreService.ts +23 -10
- package/src/common/services/DecorationService.ts +260 -15
- package/src/common/services/InstantiationService.ts +2 -2
- package/src/common/services/LogService.ts +2 -32
- package/src/common/services/{CoreMouseService.ts → MouseStateService.ts} +22 -133
- package/src/common/services/OptionsService.ts +17 -7
- package/src/common/services/OscLinkService.ts +3 -2
- package/src/common/services/ServiceRegistry.ts +14 -8
- package/src/common/services/Services.ts +54 -50
- package/src/common/services/UnicodeService.ts +6 -11
- package/typings/xterm.d.ts +329 -34
- package/src/common/Clone.ts +0 -23
- package/src/common/TypedArrayUtils.ts +0 -17
- package/src/vs/base/browser/browser.ts +0 -141
- package/src/vs/base/browser/canIUse.ts +0 -49
- package/src/vs/base/browser/dom.ts +0 -2369
- package/src/vs/base/browser/fastDomNode.ts +0 -316
- package/src/vs/base/browser/globalPointerMoveMonitor.ts +0 -112
- package/src/vs/base/browser/iframe.ts +0 -135
- package/src/vs/base/browser/keyboardEvent.ts +0 -213
- package/src/vs/base/browser/mouseEvent.ts +0 -229
- package/src/vs/base/browser/touch.ts +0 -372
- package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +0 -303
- package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +0 -114
- package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +0 -720
- package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +0 -165
- package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +0 -114
- package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +0 -243
- package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +0 -118
- package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +0 -116
- package/src/vs/base/browser/ui/widget.ts +0 -57
- package/src/vs/base/browser/window.ts +0 -14
- package/src/vs/base/common/arrays.ts +0 -887
- package/src/vs/base/common/arraysFind.ts +0 -202
- package/src/vs/base/common/assert.ts +0 -71
- package/src/vs/base/common/async.ts +0 -1992
- package/src/vs/base/common/cancellation.ts +0 -148
- package/src/vs/base/common/charCode.ts +0 -450
- package/src/vs/base/common/collections.ts +0 -140
- package/src/vs/base/common/decorators.ts +0 -130
- package/src/vs/base/common/equals.ts +0 -146
- package/src/vs/base/common/errors.ts +0 -303
- package/src/vs/base/common/event.ts +0 -1778
- package/src/vs/base/common/functional.ts +0 -32
- package/src/vs/base/common/hash.ts +0 -316
- package/src/vs/base/common/iterator.ts +0 -159
- package/src/vs/base/common/keyCodes.ts +0 -526
- package/src/vs/base/common/keybindings.ts +0 -284
- package/src/vs/base/common/lazy.ts +0 -47
- package/src/vs/base/common/lifecycle.ts +0 -801
- package/src/vs/base/common/linkedList.ts +0 -142
- package/src/vs/base/common/map.ts +0 -202
- package/src/vs/base/common/numbers.ts +0 -98
- package/src/vs/base/common/observable.ts +0 -76
- package/src/vs/base/common/observableInternal/api.ts +0 -31
- package/src/vs/base/common/observableInternal/autorun.ts +0 -281
- package/src/vs/base/common/observableInternal/base.ts +0 -489
- package/src/vs/base/common/observableInternal/debugName.ts +0 -145
- package/src/vs/base/common/observableInternal/derived.ts +0 -428
- package/src/vs/base/common/observableInternal/lazyObservableValue.ts +0 -146
- package/src/vs/base/common/observableInternal/logging.ts +0 -328
- package/src/vs/base/common/observableInternal/promise.ts +0 -209
- package/src/vs/base/common/observableInternal/utils.ts +0 -610
- package/src/vs/base/common/platform.ts +0 -281
- package/src/vs/base/common/scrollable.ts +0 -522
- package/src/vs/base/common/sequence.ts +0 -34
- package/src/vs/base/common/stopwatch.ts +0 -43
- package/src/vs/base/common/strings.ts +0 -557
- package/src/vs/base/common/symbols.ts +0 -9
- package/src/vs/base/common/uint.ts +0 -59
- package/src/vs/patches/nls.ts +0 -90
- package/src/vs/typings/base-common.d.ts +0 -20
- package/src/vs/typings/require.d.ts +0 -42
- package/src/vs/typings/vscode-globals-nls.d.ts +0 -36
- 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 '
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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 '
|
|
7
|
-
import { stringFromCodePoint } from '
|
|
8
|
-
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from '
|
|
9
|
-
import { AttributeData, ExtendedAttrs } from '
|
|
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
|
|
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.
|
|
40
|
-
* write: `content |= codepoint & Content.
|
|
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
|
|
48
|
-
* read: `isCombined = content & Content.
|
|
49
|
-
* set: `content |= Content.
|
|
50
|
-
* clear: `content &= ~Content.
|
|
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.
|
|
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.
|
|
65
|
-
* `hasWidth = content & Content.
|
|
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.
|
|
68
|
-
* write: `content |= (width << Content.
|
|
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.
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
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 {
|
|
7
|
-
import type {
|
|
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:
|
|
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 '
|
|
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
|
|
10
|
+
export const enum C0 {
|
|
11
11
|
/** Null (Caret = ^@, C = \0) */
|
|
12
|
-
|
|
12
|
+
NUL = '\x00',
|
|
13
13
|
/** Start of Heading (Caret = ^A) */
|
|
14
|
-
|
|
14
|
+
SOH = '\x01',
|
|
15
15
|
/** Start of Text (Caret = ^B) */
|
|
16
|
-
|
|
16
|
+
STX = '\x02',
|
|
17
17
|
/** End of Text (Caret = ^C) */
|
|
18
|
-
|
|
18
|
+
ETX = '\x03',
|
|
19
19
|
/** End of Transmission (Caret = ^D) */
|
|
20
|
-
|
|
20
|
+
EOT = '\x04',
|
|
21
21
|
/** Enquiry (Caret = ^E) */
|
|
22
|
-
|
|
22
|
+
ENQ = '\x05',
|
|
23
23
|
/** Acknowledge (Caret = ^F) */
|
|
24
|
-
|
|
24
|
+
ACK = '\x06',
|
|
25
25
|
/** Bell (Caret = ^G, C = \a) */
|
|
26
|
-
|
|
26
|
+
BEL = '\x07',
|
|
27
27
|
/** Backspace (Caret = ^H, C = \b) */
|
|
28
|
-
|
|
28
|
+
BS = '\x08',
|
|
29
29
|
/** Character Tabulation, Horizontal Tabulation (Caret = ^I, C = \t) */
|
|
30
|
-
|
|
30
|
+
HT = '\x09',
|
|
31
31
|
/** Line Feed (Caret = ^J, C = \n) */
|
|
32
|
-
|
|
32
|
+
LF = '\x0a',
|
|
33
33
|
/** Line Tabulation, Vertical Tabulation (Caret = ^K, C = \v) */
|
|
34
|
-
|
|
34
|
+
VT = '\x0b',
|
|
35
35
|
/** Form Feed (Caret = ^L, C = \f) */
|
|
36
|
-
|
|
36
|
+
FF = '\x0c',
|
|
37
37
|
/** Carriage Return (Caret = ^M, C = \r) */
|
|
38
|
-
|
|
38
|
+
CR = '\x0d',
|
|
39
39
|
/** Shift Out (Caret = ^N) */
|
|
40
|
-
|
|
40
|
+
SO = '\x0e',
|
|
41
41
|
/** Shift In (Caret = ^O) */
|
|
42
|
-
|
|
42
|
+
SI = '\x0f',
|
|
43
43
|
/** Data Link Escape (Caret = ^P) */
|
|
44
|
-
|
|
44
|
+
DLE = '\x10',
|
|
45
45
|
/** Device Control One (XON) (Caret = ^Q) */
|
|
46
|
-
|
|
46
|
+
DC1 = '\x11',
|
|
47
47
|
/** Device Control Two (Caret = ^R) */
|
|
48
|
-
|
|
48
|
+
DC2 = '\x12',
|
|
49
49
|
/** Device Control Three (XOFF) (Caret = ^S) */
|
|
50
|
-
|
|
50
|
+
DC3 = '\x13',
|
|
51
51
|
/** Device Control Four (Caret = ^T) */
|
|
52
|
-
|
|
52
|
+
DC4 = '\x14',
|
|
53
53
|
/** Negative Acknowledge (Caret = ^U) */
|
|
54
|
-
|
|
54
|
+
NAK = '\x15',
|
|
55
55
|
/** Synchronous Idle (Caret = ^V) */
|
|
56
|
-
|
|
56
|
+
SYN = '\x16',
|
|
57
57
|
/** End of Transmission Block (Caret = ^W) */
|
|
58
|
-
|
|
58
|
+
ETB = '\x17',
|
|
59
59
|
/** Cancel (Caret = ^X) */
|
|
60
|
-
|
|
60
|
+
CAN = '\x18',
|
|
61
61
|
/** End of Medium (Caret = ^Y) */
|
|
62
|
-
|
|
62
|
+
EM = '\x19',
|
|
63
63
|
/** Substitute (Caret = ^Z) */
|
|
64
|
-
|
|
64
|
+
SUB = '\x1a',
|
|
65
65
|
/** Escape (Caret = ^[, C = \e) */
|
|
66
|
-
|
|
66
|
+
ESC = '\x1b',
|
|
67
67
|
/** File Separator (Caret = ^\) */
|
|
68
|
-
|
|
68
|
+
FS = '\x1c',
|
|
69
69
|
/** Group Separator (Caret = ^]) */
|
|
70
|
-
|
|
70
|
+
GS = '\x1d',
|
|
71
71
|
/** Record Separator (Caret = ^^) */
|
|
72
|
-
|
|
72
|
+
RS = '\x1e',
|
|
73
73
|
/** Unit Separator (Caret = ^_) */
|
|
74
|
-
|
|
74
|
+
US = '\x1f',
|
|
75
75
|
/** Space */
|
|
76
|
-
|
|
76
|
+
SP = '\x20',
|
|
77
77
|
/** Delete (Caret = ^?) */
|
|
78
|
-
|
|
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
|
|
85
|
+
export const enum C1 {
|
|
86
86
|
/** padding character */
|
|
87
|
-
|
|
87
|
+
PAD = '\x80',
|
|
88
88
|
/** High Octet Preset */
|
|
89
|
-
|
|
89
|
+
HOP = '\x81',
|
|
90
90
|
/** Break Permitted Here */
|
|
91
|
-
|
|
91
|
+
BPH = '\x82',
|
|
92
92
|
/** No Break Here */
|
|
93
|
-
|
|
93
|
+
NBH = '\x83',
|
|
94
94
|
/** Index */
|
|
95
|
-
|
|
95
|
+
IND = '\x84',
|
|
96
96
|
/** Next Line */
|
|
97
|
-
|
|
97
|
+
NEL = '\x85',
|
|
98
98
|
/** Start of Selected Area */
|
|
99
|
-
|
|
99
|
+
SSA = '\x86',
|
|
100
100
|
/** End of Selected Area */
|
|
101
|
-
|
|
101
|
+
ESA = '\x87',
|
|
102
102
|
/** Horizontal Tabulation Set */
|
|
103
|
-
|
|
103
|
+
HTS = '\x88',
|
|
104
104
|
/** Horizontal Tabulation With Justification */
|
|
105
|
-
|
|
105
|
+
HTJ = '\x89',
|
|
106
106
|
/** Vertical Tabulation Set */
|
|
107
|
-
|
|
107
|
+
VTS = '\x8a',
|
|
108
108
|
/** Partial Line Down */
|
|
109
|
-
|
|
109
|
+
PLD = '\x8b',
|
|
110
110
|
/** Partial Line Up */
|
|
111
|
-
|
|
111
|
+
PLU = '\x8c',
|
|
112
112
|
/** Reverse Index */
|
|
113
|
-
|
|
113
|
+
RI = '\x8d',
|
|
114
114
|
/** Single-Shift 2 */
|
|
115
|
-
|
|
115
|
+
SS2 = '\x8e',
|
|
116
116
|
/** Single-Shift 3 */
|
|
117
|
-
|
|
117
|
+
SS3 = '\x8f',
|
|
118
118
|
/** Device Control String */
|
|
119
|
-
|
|
119
|
+
DCS = '\x90',
|
|
120
120
|
/** Private Use 1 */
|
|
121
|
-
|
|
121
|
+
PU1 = '\x91',
|
|
122
122
|
/** Private Use 2 */
|
|
123
|
-
|
|
123
|
+
PU2 = '\x92',
|
|
124
124
|
/** Set Transmit State */
|
|
125
|
-
|
|
125
|
+
STS = '\x93',
|
|
126
126
|
/** Destructive backspace, intended to eliminate ambiguity about meaning of BS. */
|
|
127
|
-
|
|
127
|
+
CCH = '\x94',
|
|
128
128
|
/** Message Waiting */
|
|
129
|
-
|
|
129
|
+
MW = '\x95',
|
|
130
130
|
/** Start of Protected Area */
|
|
131
|
-
|
|
131
|
+
SPA = '\x96',
|
|
132
132
|
/** End of Protected Area */
|
|
133
|
-
|
|
133
|
+
EPA = '\x97',
|
|
134
134
|
/** Start of String */
|
|
135
|
-
|
|
135
|
+
SOS = '\x98',
|
|
136
136
|
/** Single Graphic Character Introducer */
|
|
137
|
-
|
|
137
|
+
SGCI = '\x99',
|
|
138
138
|
/** Single Character Introducer */
|
|
139
|
-
|
|
139
|
+
SCI = '\x9a',
|
|
140
140
|
/** Control Sequence Introducer */
|
|
141
|
-
|
|
141
|
+
CSI = '\x9b',
|
|
142
142
|
/** String Terminator */
|
|
143
|
-
|
|
143
|
+
ST = '\x9c',
|
|
144
144
|
/** Operating System Command */
|
|
145
|
-
|
|
145
|
+
OSC = '\x9d',
|
|
146
146
|
/** Privacy Message */
|
|
147
|
-
|
|
147
|
+
PM = '\x9e',
|
|
148
148
|
/** Application Program Command */
|
|
149
|
-
|
|
149
|
+
APC = '\x9f'
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
|
|
152
|
+
export const enum C1ESCAPED {
|
|
153
|
+
ST = '\x1b\\'
|
|
153
154
|
}
|