@xterm/xterm 5.6.0-beta.5 → 5.6.0-beta.50
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 +6 -3
- package/css/xterm.css +71 -4
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +53 -0
- package/lib/xterm.mjs.map +7 -0
- package/package.json +40 -31
- package/src/browser/AccessibilityManager.ts +39 -11
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +85 -97
- package/src/browser/Linkifier.ts +3 -3
- package/src/browser/LocalizableStrings.ts +15 -4
- package/src/browser/{Types.d.ts → Types.ts} +67 -15
- package/src/browser/Viewport.ts +142 -364
- package/src/browser/decorations/BufferDecorationRenderer.ts +6 -1
- package/src/browser/decorations/OverviewRulerRenderer.ts +32 -36
- package/src/browser/public/Terminal.ts +21 -15
- package/src/browser/renderer/dom/DomRenderer.ts +8 -10
- package/src/browser/renderer/shared/CharAtlasUtils.ts +4 -0
- package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
- package/src/browser/renderer/shared/TextureAtlas.ts +3 -3
- package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +4 -4
- package/src/browser/services/CharSizeService.ts +2 -2
- package/src/browser/services/CoreBrowserService.ts +13 -9
- package/src/browser/services/RenderService.ts +5 -5
- package/src/browser/services/SelectionService.ts +5 -5
- package/src/browser/services/Services.ts +13 -13
- package/src/browser/services/ThemeService.ts +14 -53
- package/src/browser/shared/Constants.ts +8 -0
- package/src/common/CircularList.ts +4 -4
- package/src/common/CoreTerminal.ts +22 -28
- package/src/common/InputHandler.ts +31 -25
- package/src/common/{Types.d.ts → Types.ts} +11 -17
- package/src/common/buffer/Buffer.ts +5 -1
- package/src/common/buffer/BufferSet.ts +2 -2
- package/src/common/buffer/Marker.ts +2 -2
- package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
- package/src/common/input/WriteBuffer.ts +2 -2
- package/src/common/public/BufferNamespaceApi.ts +2 -2
- package/src/common/services/BufferService.ts +5 -5
- package/src/common/services/CoreMouseService.ts +4 -2
- package/src/common/services/CoreService.ts +5 -5
- package/src/common/services/DecorationService.ts +5 -5
- package/src/common/services/OptionsService.ts +3 -3
- package/src/common/services/Services.ts +24 -17
- package/src/common/services/UnicodeService.ts +2 -2
- package/src/vs/base/browser/browser.ts +141 -0
- package/src/vs/base/browser/canIUse.ts +49 -0
- package/src/vs/base/browser/dom.ts +2369 -0
- package/src/vs/base/browser/fastDomNode.ts +316 -0
- package/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/src/vs/base/browser/iframe.ts +135 -0
- package/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/src/vs/base/browser/mouseEvent.ts +229 -0
- package/src/vs/base/browser/touch.ts +372 -0
- package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/src/vs/base/browser/ui/widget.ts +57 -0
- package/src/vs/base/browser/window.ts +14 -0
- package/src/vs/base/common/arrays.ts +887 -0
- package/src/vs/base/common/arraysFind.ts +202 -0
- package/src/vs/base/common/assert.ts +71 -0
- package/src/vs/base/common/async.ts +1992 -0
- package/src/vs/base/common/cancellation.ts +148 -0
- package/src/vs/base/common/charCode.ts +450 -0
- package/src/vs/base/common/collections.ts +140 -0
- package/src/vs/base/common/decorators.ts +130 -0
- package/src/vs/base/common/equals.ts +146 -0
- package/src/vs/base/common/errors.ts +303 -0
- package/src/vs/base/common/event.ts +1778 -0
- package/src/vs/base/common/functional.ts +32 -0
- package/src/vs/base/common/hash.ts +316 -0
- package/src/vs/base/common/iterator.ts +159 -0
- package/src/vs/base/common/keyCodes.ts +526 -0
- package/src/vs/base/common/keybindings.ts +284 -0
- package/src/vs/base/common/lazy.ts +47 -0
- package/src/vs/base/common/lifecycle.ts +801 -0
- package/src/vs/base/common/linkedList.ts +142 -0
- package/src/vs/base/common/map.ts +202 -0
- package/src/vs/base/common/numbers.ts +98 -0
- package/src/vs/base/common/observable.ts +76 -0
- package/src/vs/base/common/observableInternal/api.ts +31 -0
- package/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/src/vs/base/common/observableInternal/base.ts +489 -0
- package/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/src/vs/base/common/platform.ts +281 -0
- package/src/vs/base/common/scrollable.ts +522 -0
- package/src/vs/base/common/sequence.ts +34 -0
- package/src/vs/base/common/stopwatch.ts +43 -0
- package/src/vs/base/common/strings.ts +557 -0
- package/src/vs/base/common/symbols.ts +9 -0
- package/src/vs/base/common/uint.ts +59 -0
- package/src/vs/patches/nls.ts +90 -0
- package/src/vs/typings/base-common.d.ts +20 -0
- package/src/vs/typings/require.d.ts +42 -0
- package/src/vs/typings/thenable.d.ts +12 -0
- package/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/typings/xterm.d.ts +59 -15
- package/src/common/EventEmitter.ts +0 -78
- /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
- /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';
|
|
7
|
-
import { ICoreBrowserService, IRenderService } from 'browser/services/Services';
|
|
7
|
+
import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
|
8
8
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
9
9
|
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
|
10
10
|
|
|
11
|
+
const enum Constants {
|
|
12
|
+
OVERVIEW_RULER_BORDER_WIDTH = 1
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
// Helper objects to avoid excessive calculation and garbage collection during rendering. These are
|
|
12
16
|
// static values for each render and can be accessed using the decoration position as the key.
|
|
13
17
|
const drawHeight = {
|
|
@@ -34,7 +38,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
34
38
|
private readonly _ctx: CanvasRenderingContext2D;
|
|
35
39
|
private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();
|
|
36
40
|
private get _width(): number {
|
|
37
|
-
return this._optionsService.options.
|
|
41
|
+
return this._optionsService.options.overviewRuler?.width || 0;
|
|
38
42
|
}
|
|
39
43
|
private _animationFrame: number | undefined;
|
|
40
44
|
|
|
@@ -51,6 +55,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
51
55
|
@IDecorationService private readonly _decorationService: IDecorationService,
|
|
52
56
|
@IRenderService private readonly _renderService: IRenderService,
|
|
53
57
|
@IOptionsService private readonly _optionsService: IOptionsService,
|
|
58
|
+
@IThemeService private readonly _themeService: IThemeService,
|
|
54
59
|
@ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService
|
|
55
60
|
) {
|
|
56
61
|
super();
|
|
@@ -58,33 +63,18 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
58
63
|
this._canvas.classList.add('xterm-decoration-overview-ruler');
|
|
59
64
|
this._refreshCanvasDimensions();
|
|
60
65
|
this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);
|
|
66
|
+
this.register(toDisposable(() => this._canvas?.remove()));
|
|
67
|
+
|
|
61
68
|
const ctx = this._canvas.getContext('2d');
|
|
62
69
|
if (!ctx) {
|
|
63
70
|
throw new Error('Ctx cannot be null');
|
|
64
71
|
} else {
|
|
65
72
|
this._ctx = ctx;
|
|
66
73
|
}
|
|
67
|
-
this._registerDecorationListeners();
|
|
68
|
-
this._registerBufferChangeListeners();
|
|
69
|
-
this._registerDimensionChangeListeners();
|
|
70
|
-
this.register(toDisposable(() => {
|
|
71
|
-
this._canvas?.remove();
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
74
|
|
|
75
|
-
/**
|
|
76
|
-
* On decoration add or remove, redraw
|
|
77
|
-
*/
|
|
78
|
-
private _registerDecorationListeners(): void {
|
|
79
75
|
this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));
|
|
80
76
|
this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));
|
|
81
|
-
}
|
|
82
77
|
|
|
83
|
-
/**
|
|
84
|
-
* On buffer change, redraw
|
|
85
|
-
* and hide the canvas if the alt buffer is active
|
|
86
|
-
*/
|
|
87
|
-
private _registerBufferChangeListeners(): void {
|
|
88
78
|
this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));
|
|
89
79
|
this.register(this._bufferService.buffers.onBufferActivate(() => {
|
|
90
80
|
this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';
|
|
@@ -95,31 +85,25 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
95
85
|
this._refreshColorZonePadding();
|
|
96
86
|
}
|
|
97
87
|
}));
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* On dimension change, update canvas dimensions
|
|
101
|
-
* and then redraw
|
|
102
|
-
*/
|
|
103
|
-
private _registerDimensionChangeListeners(): void {
|
|
104
|
-
// container height changed
|
|
88
|
+
|
|
89
|
+
// Container height changed
|
|
105
90
|
this.register(this._renderService.onRender((): void => {
|
|
106
91
|
if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {
|
|
107
92
|
this._queueRefresh(true);
|
|
108
93
|
this._containerHeight = this._screenElement.clientHeight;
|
|
109
94
|
}
|
|
110
95
|
}));
|
|
111
|
-
|
|
112
|
-
this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true)));
|
|
113
|
-
// device pixel ratio changed
|
|
96
|
+
|
|
114
97
|
this.register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
|
|
115
|
-
|
|
98
|
+
this.register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));
|
|
99
|
+
this.register(this._themeService.onChangeColors(() => this._queueRefresh()));
|
|
116
100
|
this._queueRefresh(true);
|
|
117
101
|
}
|
|
118
102
|
|
|
119
103
|
private _refreshDrawConstants(): void {
|
|
120
104
|
// width
|
|
121
|
-
const outerWidth = Math.floor(this._canvas.width / 3);
|
|
122
|
-
const innerWidth = Math.ceil(this._canvas.width / 3);
|
|
105
|
+
const outerWidth = Math.floor((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);
|
|
106
|
+
const innerWidth = Math.ceil((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);
|
|
123
107
|
drawWidth.full = this._canvas.width;
|
|
124
108
|
drawWidth.left = outerWidth;
|
|
125
109
|
drawWidth.center = innerWidth;
|
|
@@ -127,10 +111,10 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
127
111
|
// height
|
|
128
112
|
this._refreshDrawHeightConstants();
|
|
129
113
|
// x
|
|
130
|
-
drawX.full =
|
|
131
|
-
drawX.left =
|
|
132
|
-
drawX.center = drawWidth.left;
|
|
133
|
-
drawX.right = drawWidth.left + drawWidth.center;
|
|
114
|
+
drawX.full = Constants.OVERVIEW_RULER_BORDER_WIDTH;
|
|
115
|
+
drawX.left = Constants.OVERVIEW_RULER_BORDER_WIDTH;
|
|
116
|
+
drawX.center = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left;
|
|
117
|
+
drawX.right = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left + drawWidth.center;
|
|
134
118
|
}
|
|
135
119
|
|
|
136
120
|
private _refreshDrawHeightConstants(): void {
|
|
@@ -173,6 +157,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
173
157
|
this._colorZoneStore.addDecoration(decoration);
|
|
174
158
|
}
|
|
175
159
|
this._ctx.lineWidth = 1;
|
|
160
|
+
this._renderRulerOutline();
|
|
176
161
|
const zones = this._colorZoneStore.zones;
|
|
177
162
|
for (const zone of zones) {
|
|
178
163
|
if (zone.position !== 'full') {
|
|
@@ -188,6 +173,17 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
188
173
|
this._shouldUpdateAnchor = false;
|
|
189
174
|
}
|
|
190
175
|
|
|
176
|
+
private _renderRulerOutline(): void {
|
|
177
|
+
this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;
|
|
178
|
+
this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
|
|
179
|
+
if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {
|
|
180
|
+
this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);
|
|
181
|
+
}
|
|
182
|
+
if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {
|
|
183
|
+
this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
191
187
|
private _renderColorZone(zone: IColorZone): void {
|
|
192
188
|
this._ctx.fillStyle = zone.color;
|
|
193
189
|
this._ctx.fillRect(
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import * as Strings from 'browser/LocalizableStrings';
|
|
7
|
-
import {
|
|
7
|
+
import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
|
|
8
8
|
import { IBufferRange, ITerminal } from 'browser/Types';
|
|
9
|
-
import { IEvent } from 'common/EventEmitter';
|
|
10
9
|
import { Disposable } from 'common/Lifecycle';
|
|
11
10
|
import { ITerminalOptions } from 'common/Types';
|
|
12
11
|
import { AddonManager } from 'common/public/AddonManager';
|
|
@@ -14,6 +13,7 @@ import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
|
|
|
14
13
|
import { ParserApi } from 'common/public/ParserApi';
|
|
15
14
|
import { UnicodeApi } from 'common/public/UnicodeApi';
|
|
16
15
|
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
|
|
16
|
+
import type { Event } from 'vs/base/common/event';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The set of options that only have an effect when set in the Terminal constructor.
|
|
@@ -68,18 +68,18 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
public get onBell():
|
|
72
|
-
public get onBinary():
|
|
73
|
-
public get onCursorMove():
|
|
74
|
-
public get onData():
|
|
75
|
-
public get onKey():
|
|
76
|
-
public get onLineFeed():
|
|
77
|
-
public get onRender():
|
|
78
|
-
public get onResize():
|
|
79
|
-
public get onScroll():
|
|
80
|
-
public get onSelectionChange():
|
|
81
|
-
public get onTitleChange():
|
|
82
|
-
public get onWriteParsed():
|
|
71
|
+
public get onBell(): Event<void> { return this._core.onBell; }
|
|
72
|
+
public get onBinary(): Event<string> { return this._core.onBinary; }
|
|
73
|
+
public get onCursorMove(): Event<void> { return this._core.onCursorMove; }
|
|
74
|
+
public get onData(): Event<string> { return this._core.onData; }
|
|
75
|
+
public get onKey(): Event<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }
|
|
76
|
+
public get onLineFeed(): Event<void> { return this._core.onLineFeed; }
|
|
77
|
+
public get onRender(): Event<{ start: number, end: number }> { return this._core.onRender; }
|
|
78
|
+
public get onResize(): Event<{ cols: number, rows: number }> { return this._core.onResize; }
|
|
79
|
+
public get onScroll(): Event<number> { return this._core.onScroll; }
|
|
80
|
+
public get onSelectionChange(): Event<void> { return this._core.onSelectionChange; }
|
|
81
|
+
public get onTitleChange(): Event<string> { return this._core.onTitleChange; }
|
|
82
|
+
public get onWriteParsed(): Event<void> { return this._core.onWriteParsed; }
|
|
83
83
|
|
|
84
84
|
public get element(): HTMLElement | undefined { return this._core.element; }
|
|
85
85
|
public get parser(): IParser {
|
|
@@ -247,7 +247,13 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|
|
247
247
|
this._addonManager.loadAddon(this, addon);
|
|
248
248
|
}
|
|
249
249
|
public static get strings(): ILocalizableStrings {
|
|
250
|
-
|
|
250
|
+
// A wrapper is required here because esbuild prevents setting an `export let`
|
|
251
|
+
return {
|
|
252
|
+
get promptLabel(): string { return Strings.promptLabel.get(); },
|
|
253
|
+
set promptLabel(value: string) { Strings.promptLabel.set(value); },
|
|
254
|
+
get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },
|
|
255
|
+
set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }
|
|
256
|
+
};
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
private _verifyIntegers(...values: number[]): void {
|
|
@@ -12,9 +12,9 @@ import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderMode
|
|
|
12
12
|
import { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
|
13
13
|
import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';
|
|
14
14
|
import { color } from 'common/Color';
|
|
15
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
16
15
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
17
16
|
import { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';
|
|
17
|
+
import { Emitter } from 'vs/base/common/event';
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
const TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';
|
|
@@ -27,9 +27,9 @@ const SELECTION_CLASS = 'xterm-selection';
|
|
|
27
27
|
let nextTerminalId = 1;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* particularly fast
|
|
32
|
-
*
|
|
30
|
+
* The standard renderer and fallback for when the webgl addon is slow. This is not meant to be
|
|
31
|
+
* particularly fast and will even lack some features such as custom glyphs, hoever this is more
|
|
32
|
+
* reliable as webgl may not work on some machines.
|
|
33
33
|
*/
|
|
34
34
|
export class DomRenderer extends Disposable implements IRenderer {
|
|
35
35
|
private _rowFactory: DomRendererRowFactory;
|
|
@@ -45,7 +45,7 @@ export class DomRenderer extends Disposable implements IRenderer {
|
|
|
45
45
|
|
|
46
46
|
public dimensions: IRenderDimensions;
|
|
47
47
|
|
|
48
|
-
public readonly onRequestRedraw = this.register(new
|
|
48
|
+
public readonly onRequestRedraw = this.register(new Emitter<IRequestRedrawEvent>()).event;
|
|
49
49
|
|
|
50
50
|
constructor(
|
|
51
51
|
private readonly _terminal: ITerminal,
|
|
@@ -343,6 +343,9 @@ export class DomRenderer extends Disposable implements IRenderer {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
this._selectionRenderModel.update(this._terminal, start, end, columnSelectMode);
|
|
346
|
+
if (!this._selectionRenderModel.hasSelection) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
346
349
|
|
|
347
350
|
// Translate from buffer position to viewport position
|
|
348
351
|
const viewportStartRow = this._selectionRenderModel.viewportStartRow;
|
|
@@ -350,11 +353,6 @@ export class DomRenderer extends Disposable implements IRenderer {
|
|
|
350
353
|
const viewportCappedStartRow = this._selectionRenderModel.viewportCappedStartRow;
|
|
351
354
|
const viewportCappedEndRow = this._selectionRenderModel.viewportCappedEndRow;
|
|
352
355
|
|
|
353
|
-
// No need to draw the selection
|
|
354
|
-
if (viewportCappedStartRow >= this._bufferService.rows || viewportCappedEndRow < 0) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
356
|
// Create the selections
|
|
359
357
|
const documentFragment = this._document.createDocumentFragment();
|
|
360
358
|
|
|
@@ -21,6 +21,10 @@ export function generateConfig(deviceCellWidth: number, deviceCellHeight: number
|
|
|
21
21
|
selectionBackgroundOpaque: NULL_COLOR,
|
|
22
22
|
selectionInactiveBackgroundTransparent: NULL_COLOR,
|
|
23
23
|
selectionInactiveBackgroundOpaque: NULL_COLOR,
|
|
24
|
+
overviewRulerBorder: NULL_COLOR,
|
|
25
|
+
scrollbarSliderBackground: NULL_COLOR,
|
|
26
|
+
scrollbarSliderHoverBackground: NULL_COLOR,
|
|
27
|
+
scrollbarSliderActiveBackground: NULL_COLOR,
|
|
24
28
|
// For the static char atlas, we only use the first 16 colors, but we need all 256 for the
|
|
25
29
|
// dynamic character atlas.
|
|
26
30
|
ansi: colors.ansi.slice(),
|
|
@@ -355,6 +355,12 @@ const enum VectorType {
|
|
|
355
355
|
* Original symbols defined in https://github.com/powerline/fontpatcher
|
|
356
356
|
*/
|
|
357
357
|
export const powerlineDefinitions: { [index: string]: IVectorShape } = {
|
|
358
|
+
// Git branch
|
|
359
|
+
'\u{E0A0}': { d: 'M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655', type: VectorType.FILL },
|
|
360
|
+
// L N
|
|
361
|
+
'\u{E0A1}': { d: 'M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5', type: VectorType.FILL },
|
|
362
|
+
// Lock
|
|
363
|
+
'\u{E0A2}': { d: 'M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82', type: VectorType.FILL },
|
|
358
364
|
// Right triangle solid
|
|
359
365
|
'\u{E0B0}': { d: 'M0,0 L1,.5 L0,1', type: VectorType.FILL, rightPadding: 2 },
|
|
360
366
|
// Right triangle line
|
|
@@ -9,13 +9,13 @@ import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
|
|
9
9
|
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
|
10
10
|
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from 'browser/renderer/shared/Types';
|
|
11
11
|
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
|
|
12
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
13
12
|
import { FourKeyMap } from 'common/MultiKeyMap';
|
|
14
13
|
import { IdleTaskQueue } from 'common/TaskQueue';
|
|
15
14
|
import { IColor } from 'common/Types';
|
|
16
15
|
import { AttributeData } from 'common/buffer/AttributeData';
|
|
17
16
|
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
|
|
18
17
|
import { IUnicodeService } from 'common/services/Services';
|
|
18
|
+
import { Emitter } from 'vs/base/common/event';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A shared object which is used to draw nothing for a particular cell.
|
|
@@ -79,9 +79,9 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
79
79
|
public static maxAtlasPages: number | undefined;
|
|
80
80
|
public static maxTextureSize: number | undefined;
|
|
81
81
|
|
|
82
|
-
private readonly _onAddTextureAtlasCanvas = new
|
|
82
|
+
private readonly _onAddTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
|
|
83
83
|
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event;
|
|
84
|
-
private readonly _onRemoveTextureAtlasCanvas = new
|
|
84
|
+
private readonly _onRemoveTextureAtlasCanvas = new Emitter<HTMLCanvasElement>();
|
|
85
85
|
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event;
|
|
86
86
|
|
|
87
87
|
constructor(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { FontWeight, Terminal } from '@xterm/xterm';
|
|
7
7
|
import { IColorSet, ITerminal } from 'browser/Types';
|
|
8
8
|
import { IDisposable } from 'common/Types';
|
|
9
|
-
import {
|
|
9
|
+
import type { Event } from 'vs/base/common/event';
|
|
10
10
|
|
|
11
11
|
export interface ICharAtlasConfig {
|
|
12
12
|
customGlyphs: boolean;
|
|
@@ -71,7 +71,7 @@ export interface IRenderer extends IDisposable {
|
|
|
71
71
|
* Fires when the renderer is requesting to be redrawn on the next animation
|
|
72
72
|
* frame but is _not_ a result of content changing (eg. selection changes).
|
|
73
73
|
*/
|
|
74
|
-
readonly onRequestRedraw:
|
|
74
|
+
readonly onRequestRedraw: Event<IRequestRedrawEvent>;
|
|
75
75
|
|
|
76
76
|
dispose(): void;
|
|
77
77
|
handleDevicePixelRatioChange(): void;
|
|
@@ -89,8 +89,8 @@ export interface IRenderer extends IDisposable {
|
|
|
89
89
|
export interface ITextureAtlas extends IDisposable {
|
|
90
90
|
readonly pages: { canvas: HTMLCanvasElement, version: number }[];
|
|
91
91
|
|
|
92
|
-
onAddTextureAtlasCanvas:
|
|
93
|
-
onRemoveTextureAtlasCanvas:
|
|
92
|
+
onAddTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
|
93
|
+
onRemoveTextureAtlasCanvas: Event<HTMLCanvasElement>;
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Warm up the texture atlas, adding common glyphs to avoid slowing early frame.
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IOptionsService } from 'common/services/Services';
|
|
7
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
8
7
|
import { ICharSizeService } from 'browser/services/Services';
|
|
9
8
|
import { Disposable } from 'common/Lifecycle';
|
|
9
|
+
import { Emitter } from 'vs/base/common/event';
|
|
10
10
|
|
|
11
11
|
export class CharSizeService extends Disposable implements ICharSizeService {
|
|
12
12
|
public serviceBrand: undefined;
|
|
@@ -17,7 +17,7 @@ export class CharSizeService extends Disposable implements ICharSizeService {
|
|
|
17
17
|
|
|
18
18
|
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
|
|
19
19
|
|
|
20
|
-
private readonly _onCharSizeChange = this.register(new
|
|
20
|
+
private readonly _onCharSizeChange = this.register(new Emitter<void>());
|
|
21
21
|
public readonly onCharSizeChange = this._onCharSizeChange.event;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
|
7
7
|
import { ICoreBrowserService } from './Services';
|
|
8
|
-
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
|
|
9
8
|
import { addDisposableDomListener } from 'browser/Lifecycle';
|
|
9
|
+
import { Emitter, Event } from 'vs/base/common/event';
|
|
10
10
|
|
|
11
11
|
export class CoreBrowserService extends Disposable implements ICoreBrowserService {
|
|
12
12
|
public serviceBrand: undefined;
|
|
13
13
|
|
|
14
14
|
private _isFocused = false;
|
|
15
15
|
private _cachedIsFocused: boolean | undefined = undefined;
|
|
16
|
-
private _screenDprMonitor = new ScreenDprMonitor(this._window);
|
|
16
|
+
private _screenDprMonitor = this.register(new ScreenDprMonitor(this._window));
|
|
17
17
|
|
|
18
|
-
private readonly _onDprChange = this.register(new
|
|
18
|
+
private readonly _onDprChange = this.register(new Emitter<number>());
|
|
19
19
|
public readonly onDprChange = this._onDprChange.event;
|
|
20
|
-
private readonly _onWindowChange = this.register(new
|
|
20
|
+
private readonly _onWindowChange = this.register(new Emitter<Window & typeof globalThis>());
|
|
21
21
|
public readonly onWindowChange = this._onWindowChange.event;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
@@ -29,10 +29,14 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
|
|
|
29
29
|
|
|
30
30
|
// Monitor device pixel ratio
|
|
31
31
|
this.register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
|
|
32
|
-
this.register(
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
|
|
32
|
+
this.register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));
|
|
33
|
+
|
|
34
|
+
this.register(
|
|
35
|
+
addDisposableDomListener(this._textarea, 'focus', () => (this._isFocused = true))
|
|
36
|
+
);
|
|
37
|
+
this.register(
|
|
38
|
+
addDisposableDomListener(this._textarea, 'blur', () => (this._isFocused = false))
|
|
39
|
+
);
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
public get window(): Window & typeof globalThis {
|
|
@@ -76,7 +80,7 @@ class ScreenDprMonitor extends Disposable {
|
|
|
76
80
|
private _resolutionMediaMatchList: MediaQueryList | undefined;
|
|
77
81
|
private _windowResizeListener = this.register(new MutableDisposable());
|
|
78
82
|
|
|
79
|
-
private readonly _onDprChange = this.register(new
|
|
83
|
+
private readonly _onDprChange = this.register(new Emitter<number>());
|
|
80
84
|
public readonly onDprChange = this._onDprChange.event;
|
|
81
85
|
|
|
82
86
|
constructor(private _parentWindow: Window) {
|
|
@@ -7,10 +7,10 @@ import { RenderDebouncer } from 'browser/RenderDebouncer';
|
|
|
7
7
|
import { IRenderDebouncerWithCallback } from 'browser/Types';
|
|
8
8
|
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
|
|
9
9
|
import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
|
10
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
11
10
|
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
|
12
11
|
import { DebouncedIdleTask } from 'common/TaskQueue';
|
|
13
12
|
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
|
13
|
+
import { Emitter } from 'vs/base/common/event';
|
|
14
14
|
|
|
15
15
|
interface ISelectionState {
|
|
16
16
|
start: [number, number] | undefined;
|
|
@@ -38,13 +38,13 @@ export class RenderService extends Disposable implements IRenderService {
|
|
|
38
38
|
columnSelectMode: false
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
private readonly _onDimensionsChange = this.register(new
|
|
41
|
+
private readonly _onDimensionsChange = this.register(new Emitter<IRenderDimensions>());
|
|
42
42
|
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
|
43
|
-
private readonly _onRenderedViewportChange = this.register(new
|
|
43
|
+
private readonly _onRenderedViewportChange = this.register(new Emitter<{ start: number, end: number }>());
|
|
44
44
|
public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;
|
|
45
|
-
private readonly _onRender = this.register(new
|
|
45
|
+
private readonly _onRender = this.register(new Emitter<{ start: number, end: number }>());
|
|
46
46
|
public readonly onRender = this._onRender.event;
|
|
47
|
-
private readonly _onRefreshRequest = this.register(new
|
|
47
|
+
private readonly _onRefreshRequest = this.register(new Emitter<{ start: number, end: number }>());
|
|
48
48
|
public readonly onRefreshRequest = this._onRefreshRequest.event;
|
|
49
49
|
|
|
50
50
|
public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }
|
|
@@ -9,7 +9,6 @@ import { moveToCellSequence } from 'browser/input/MoveToCell';
|
|
|
9
9
|
import { SelectionModel } from 'browser/selection/SelectionModel';
|
|
10
10
|
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
|
11
11
|
import { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';
|
|
12
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
13
12
|
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
14
13
|
import * as Browser from 'common/Platform';
|
|
15
14
|
import { IBufferLine, IDisposable } from 'common/Types';
|
|
@@ -17,6 +16,7 @@ import { getRangeLength } from 'common/buffer/BufferRange';
|
|
|
17
16
|
import { CellData } from 'common/buffer/CellData';
|
|
18
17
|
import { IBuffer } from 'common/buffer/Types';
|
|
19
18
|
import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
|
|
19
|
+
import { Emitter } from 'vs/base/common/event';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The number of pixels the mouse needs to be above or below the viewport in
|
|
@@ -111,13 +111,13 @@ export class SelectionService extends Disposable implements ISelectionService {
|
|
|
111
111
|
private _oldSelectionStart: [number, number] | undefined = undefined;
|
|
112
112
|
private _oldSelectionEnd: [number, number] | undefined = undefined;
|
|
113
113
|
|
|
114
|
-
private readonly _onLinuxMouseSelection = this.register(new
|
|
114
|
+
private readonly _onLinuxMouseSelection = this.register(new Emitter<string>());
|
|
115
115
|
public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;
|
|
116
|
-
private readonly _onRedrawRequest = this.register(new
|
|
116
|
+
private readonly _onRedrawRequest = this.register(new Emitter<ISelectionRedrawRequestEvent>());
|
|
117
117
|
public readonly onRequestRedraw = this._onRedrawRequest.event;
|
|
118
|
-
private readonly _onSelectionChange = this.register(new
|
|
118
|
+
private readonly _onSelectionChange = this.register(new Emitter<void>());
|
|
119
119
|
public readonly onSelectionChange = this._onSelectionChange.event;
|
|
120
|
-
private readonly _onRequestScrollLines = this.register(new
|
|
120
|
+
private readonly _onRequestScrollLines = this.register(new Emitter<ISelectionRequestScrollLinesEvent>());
|
|
121
121
|
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
|
|
122
122
|
|
|
123
123
|
constructor(
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IEvent } from 'common/EventEmitter';
|
|
7
6
|
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
|
|
8
7
|
import { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';
|
|
9
8
|
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
|
|
10
9
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
|
11
10
|
import { AllColorIndex, IDisposable } from 'common/Types';
|
|
11
|
+
import type { Event } from 'vs/base/common/event';
|
|
12
12
|
|
|
13
13
|
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
|
|
14
14
|
export interface ICharSizeService {
|
|
@@ -18,7 +18,7 @@ export interface ICharSizeService {
|
|
|
18
18
|
readonly height: number;
|
|
19
19
|
readonly hasValidSize: boolean;
|
|
20
20
|
|
|
21
|
-
readonly onCharSizeChange:
|
|
21
|
+
readonly onCharSizeChange: Event<void>;
|
|
22
22
|
|
|
23
23
|
measure(): void;
|
|
24
24
|
}
|
|
@@ -29,8 +29,8 @@ export interface ICoreBrowserService {
|
|
|
29
29
|
|
|
30
30
|
readonly isFocused: boolean;
|
|
31
31
|
|
|
32
|
-
readonly onDprChange:
|
|
33
|
-
readonly onWindowChange:
|
|
32
|
+
readonly onDprChange: Event<number>;
|
|
33
|
+
readonly onWindowChange: Event<Window & typeof globalThis>;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.
|
|
@@ -61,17 +61,17 @@ export const IRenderService = createDecorator<IRenderService>('RenderService');
|
|
|
61
61
|
export interface IRenderService extends IDisposable {
|
|
62
62
|
serviceBrand: undefined;
|
|
63
63
|
|
|
64
|
-
onDimensionsChange:
|
|
64
|
+
onDimensionsChange: Event<IRenderDimensions>;
|
|
65
65
|
/**
|
|
66
66
|
* Fires when buffer changes are rendered. This does not fire when only cursor
|
|
67
67
|
* or selections are rendered.
|
|
68
68
|
*/
|
|
69
|
-
onRenderedViewportChange:
|
|
69
|
+
onRenderedViewportChange: Event<{ start: number, end: number }>;
|
|
70
70
|
/**
|
|
71
71
|
* Fires on render
|
|
72
72
|
*/
|
|
73
|
-
onRender:
|
|
74
|
-
onRefreshRequest:
|
|
73
|
+
onRender: Event<{ start: number, end: number }>;
|
|
74
|
+
onRefreshRequest: Event<{ start: number, end: number }>;
|
|
75
75
|
|
|
76
76
|
dimensions: IRenderDimensions;
|
|
77
77
|
|
|
@@ -101,10 +101,10 @@ export interface ISelectionService {
|
|
|
101
101
|
readonly selectionStart: [number, number] | undefined;
|
|
102
102
|
readonly selectionEnd: [number, number] | undefined;
|
|
103
103
|
|
|
104
|
-
readonly onLinuxMouseSelection:
|
|
105
|
-
readonly onRequestRedraw:
|
|
106
|
-
readonly onRequestScrollLines:
|
|
107
|
-
readonly onSelectionChange:
|
|
104
|
+
readonly onLinuxMouseSelection: Event<string>;
|
|
105
|
+
readonly onRequestRedraw: Event<ISelectionRequestRedrawEvent>;
|
|
106
|
+
readonly onRequestScrollLines: Event<ISelectionRequestScrollLinesEvent>;
|
|
107
|
+
readonly onSelectionChange: Event<void>;
|
|
108
108
|
|
|
109
109
|
disable(): void;
|
|
110
110
|
enable(): void;
|
|
@@ -136,7 +136,7 @@ export interface IThemeService {
|
|
|
136
136
|
|
|
137
137
|
readonly colors: ReadonlyColorSet;
|
|
138
138
|
|
|
139
|
-
readonly onChangeColors:
|
|
139
|
+
readonly onChangeColors: Event<ReadonlyColorSet>;
|
|
140
140
|
|
|
141
141
|
restoreColor(slot?: AllColorIndex): void;
|
|
142
142
|
/**
|