@xterm/xterm 5.6.0-beta.50 → 5.6.0-beta.51
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/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +16 -16
- package/lib/xterm.mjs.map +4 -4
- package/package.json +1 -1
- package/src/browser/AccessibilityManager.ts +15 -15
- package/src/browser/CoreBrowserTerminal.ts +68 -68
- package/src/browser/Linkifier.ts +14 -12
- package/src/browser/Viewport.ts +14 -14
- package/src/browser/decorations/BufferDecorationRenderer.ts +8 -8
- package/src/browser/decorations/OverviewRulerRenderer.ts +11 -11
- package/src/browser/public/Terminal.ts +4 -4
- package/src/browser/renderer/dom/DomRenderer.ts +7 -7
- package/src/browser/renderer/shared/DevicePixelObserver.ts +1 -2
- package/src/browser/services/CharSizeService.ts +5 -5
- package/src/browser/services/CoreBrowserService.ts +15 -19
- package/src/browser/services/LinkProviderService.ts +2 -2
- package/src/browser/services/RenderService.ts +19 -19
- package/src/browser/services/SelectionService.ts +7 -7
- package/src/browser/services/ThemeService.ts +4 -4
- package/src/common/CircularList.ts +4 -4
- package/src/common/CoreTerminal.ts +27 -27
- package/src/common/InputHandler.ts +16 -16
- package/src/common/buffer/BufferSet.ts +4 -4
- package/src/common/buffer/Marker.ts +2 -2
- package/src/common/input/WriteBuffer.ts +2 -2
- package/src/common/parser/EscapeSequenceParser.ts +4 -4
- package/src/common/public/BufferNamespaceApi.ts +2 -2
- package/src/common/services/BufferService.ts +4 -4
- package/src/common/services/CoreMouseService.ts +2 -2
- package/src/common/services/CoreService.ts +5 -5
- package/src/common/services/DecorationService.ts +7 -8
- package/src/common/services/LogService.ts +2 -2
- package/src/common/services/OptionsService.ts +3 -3
- package/src/browser/Lifecycle.ts +0 -33
- package/src/common/Lifecycle.ts +0 -108
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';
|
|
7
7
|
import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
|
8
|
-
import { Disposable, toDisposable } from 'common/
|
|
8
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
9
9
|
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
|
10
10
|
|
|
11
11
|
const enum Constants {
|
|
@@ -63,7 +63,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
63
63
|
this._canvas.classList.add('xterm-decoration-overview-ruler');
|
|
64
64
|
this._refreshCanvasDimensions();
|
|
65
65
|
this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);
|
|
66
|
-
this.
|
|
66
|
+
this._register(toDisposable(() => this._canvas?.remove()));
|
|
67
67
|
|
|
68
68
|
const ctx = this._canvas.getContext('2d');
|
|
69
69
|
if (!ctx) {
|
|
@@ -72,14 +72,14 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
72
72
|
this._ctx = ctx;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
this.
|
|
76
|
-
this.
|
|
75
|
+
this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));
|
|
76
|
+
this._register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));
|
|
77
77
|
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
78
|
+
this._register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));
|
|
79
|
+
this._register(this._bufferService.buffers.onBufferActivate(() => {
|
|
80
80
|
this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';
|
|
81
81
|
}));
|
|
82
|
-
this.
|
|
82
|
+
this._register(this._bufferService.onScroll(() => {
|
|
83
83
|
if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {
|
|
84
84
|
this._refreshDrawHeightConstants();
|
|
85
85
|
this._refreshColorZonePadding();
|
|
@@ -87,16 +87,16 @@ export class OverviewRulerRenderer extends Disposable {
|
|
|
87
87
|
}));
|
|
88
88
|
|
|
89
89
|
// Container height changed
|
|
90
|
-
this.
|
|
90
|
+
this._register(this._renderService.onRender((): void => {
|
|
91
91
|
if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {
|
|
92
92
|
this._queueRefresh(true);
|
|
93
93
|
this._containerHeight = this._screenElement.clientHeight;
|
|
94
94
|
}
|
|
95
95
|
}));
|
|
96
96
|
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
97
|
+
this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));
|
|
98
|
+
this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));
|
|
99
|
+
this._register(this._themeService.onChangeColors(() => this._queueRefresh()));
|
|
100
100
|
this._queueRefresh(true);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as Strings from 'browser/LocalizableStrings';
|
|
7
7
|
import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
|
|
8
8
|
import { IBufferRange, ITerminal } from 'browser/Types';
|
|
9
|
-
import { Disposable } from 'common/
|
|
9
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
10
10
|
import { ITerminalOptions } from 'common/Types';
|
|
11
11
|
import { AddonManager } from 'common/public/AddonManager';
|
|
12
12
|
import { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';
|
|
@@ -32,8 +32,8 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|
|
32
32
|
constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {
|
|
33
33
|
super();
|
|
34
34
|
|
|
35
|
-
this._core = this.
|
|
36
|
-
this._addonManager = this.
|
|
35
|
+
this._core = this._register(new TerminalCore(options));
|
|
36
|
+
this._addonManager = this._register(new AddonManager());
|
|
37
37
|
|
|
38
38
|
this._publicOptions = { ... this._core.options };
|
|
39
39
|
const getter = (propName: string): any => {
|
|
@@ -97,7 +97,7 @@ export class Terminal extends Disposable implements ITerminalApi {
|
|
|
97
97
|
public get cols(): number { return this._core.cols; }
|
|
98
98
|
public get buffer(): IBufferNamespaceApi {
|
|
99
99
|
if (!this._buffer) {
|
|
100
|
-
this._buffer = this.
|
|
100
|
+
this._buffer = this._register(new BufferNamespaceApi(this._core));
|
|
101
101
|
}
|
|
102
102
|
return this._buffer;
|
|
103
103
|
}
|
|
@@ -12,7 +12,7 @@ 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 { Disposable, toDisposable } from 'common/
|
|
15
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
16
16
|
import { IBufferService, IInstantiationService, IOptionsService } from 'common/services/Services';
|
|
17
17
|
import { Emitter } from 'vs/base/common/event';
|
|
18
18
|
|
|
@@ -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.
|
|
48
|
+
public readonly onRequestRedraw = this._register(new Emitter<IRequestRedrawEvent>()).event;
|
|
49
49
|
|
|
50
50
|
constructor(
|
|
51
51
|
private readonly _terminal: ITerminal,
|
|
@@ -74,9 +74,9 @@ export class DomRenderer extends Disposable implements IRenderer {
|
|
|
74
74
|
|
|
75
75
|
this.dimensions = createRenderDimensions();
|
|
76
76
|
this._updateDimensions();
|
|
77
|
-
this.
|
|
77
|
+
this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));
|
|
78
78
|
|
|
79
|
-
this.
|
|
79
|
+
this._register(this._themeService.onChangeColors(e => this._injectCss(e)));
|
|
80
80
|
this._injectCss(this._themeService.colors);
|
|
81
81
|
|
|
82
82
|
this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);
|
|
@@ -85,10 +85,10 @@ export class DomRenderer extends Disposable implements IRenderer {
|
|
|
85
85
|
this._screenElement.appendChild(this._rowContainer);
|
|
86
86
|
this._screenElement.appendChild(this._selectionContainer);
|
|
87
87
|
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
88
|
+
this._register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));
|
|
89
|
+
this._register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));
|
|
90
90
|
|
|
91
|
-
this.
|
|
91
|
+
this._register(toDisposable(() => {
|
|
92
92
|
this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);
|
|
93
93
|
|
|
94
94
|
// Outside influences such as React unmounts may manipulate the DOM before our disposal.
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { toDisposable } from 'common/
|
|
7
|
-
import { IDisposable } from 'common/Types';
|
|
6
|
+
import { toDisposable, IDisposable } from 'vs/base/common/lifecycle';
|
|
8
7
|
|
|
9
8
|
export function observeDevicePixelDimensions(element: HTMLElement, parentWindow: Window & typeof globalThis, callback: (deviceWidth: number, deviceHeight: number) => void): IDisposable {
|
|
10
9
|
// Observe any resizes to the element and extract the actual pixel size of the element if the
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { IOptionsService } from 'common/services/Services';
|
|
7
7
|
import { ICharSizeService } from 'browser/services/Services';
|
|
8
|
-
import { Disposable } from 'common/
|
|
8
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
9
9
|
import { Emitter } from 'vs/base/common/event';
|
|
10
10
|
|
|
11
11
|
export class CharSizeService extends Disposable implements ICharSizeService {
|
|
@@ -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.
|
|
20
|
+
private readonly _onCharSizeChange = this._register(new Emitter<void>());
|
|
21
21
|
public readonly onCharSizeChange = this._onCharSizeChange.event;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
@@ -27,11 +27,11 @@ export class CharSizeService extends Disposable implements ICharSizeService {
|
|
|
27
27
|
) {
|
|
28
28
|
super();
|
|
29
29
|
try {
|
|
30
|
-
this._measureStrategy = this.
|
|
30
|
+
this._measureStrategy = this._register(new TextMetricsMeasureStrategy(this._optionsService));
|
|
31
31
|
} catch {
|
|
32
|
-
this._measureStrategy = this.
|
|
32
|
+
this._measureStrategy = this._register(new DomMeasureStrategy(document, parentElement, this._optionsService));
|
|
33
33
|
}
|
|
34
|
-
this.
|
|
34
|
+
this._register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public measure(): void {
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
|
7
6
|
import { ICoreBrowserService } from './Services';
|
|
8
|
-
import { addDisposableDomListener } from 'browser/Lifecycle';
|
|
9
7
|
import { Emitter, Event } from 'vs/base/common/event';
|
|
8
|
+
import { addDisposableListener } from 'vs/base/browser/dom';
|
|
9
|
+
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
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 = this.
|
|
16
|
+
private _screenDprMonitor = this._register(new ScreenDprMonitor(this._window));
|
|
17
17
|
|
|
18
|
-
private readonly _onDprChange = this.
|
|
18
|
+
private readonly _onDprChange = this._register(new Emitter<number>());
|
|
19
19
|
public readonly onDprChange = this._onDprChange.event;
|
|
20
|
-
private readonly _onWindowChange = this.
|
|
20
|
+
private readonly _onWindowChange = this._register(new Emitter<Window & typeof globalThis>());
|
|
21
21
|
public readonly onWindowChange = this._onWindowChange.event;
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
@@ -28,15 +28,11 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
|
|
|
28
28
|
super();
|
|
29
29
|
|
|
30
30
|
// Monitor device pixel ratio
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
this.register(
|
|
38
|
-
addDisposableDomListener(this._textarea, 'blur', () => (this._isFocused = false))
|
|
39
|
-
);
|
|
31
|
+
this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));
|
|
32
|
+
this._register(Event.forward(this._screenDprMonitor.onDprChange, this._onDprChange));
|
|
33
|
+
|
|
34
|
+
this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));
|
|
35
|
+
this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
public get window(): Window & typeof globalThis {
|
|
@@ -69,7 +65,7 @@ export class CoreBrowserService extends Disposable implements ICoreBrowserServic
|
|
|
69
65
|
* window.devicePixelRatio value changes. This is done not with polling but with
|
|
70
66
|
* the use of window.matchMedia to watch media queries. When the event fires,
|
|
71
67
|
* the listener will be reattached using a different media query to ensure that
|
|
72
|
-
* any further changes will
|
|
68
|
+
* any further changes will _register.
|
|
73
69
|
*
|
|
74
70
|
* The listener should fire on both window zoom changes and switching to a
|
|
75
71
|
* monitor with a different DPI.
|
|
@@ -78,9 +74,9 @@ class ScreenDprMonitor extends Disposable {
|
|
|
78
74
|
private _currentDevicePixelRatio: number;
|
|
79
75
|
private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;
|
|
80
76
|
private _resolutionMediaMatchList: MediaQueryList | undefined;
|
|
81
|
-
private _windowResizeListener = this.
|
|
77
|
+
private _windowResizeListener = this._register(new MutableDisposable());
|
|
82
78
|
|
|
83
|
-
private readonly _onDprChange = this.
|
|
79
|
+
private readonly _onDprChange = this._register(new Emitter<number>());
|
|
84
80
|
public readonly onDprChange = this._onDprChange.event;
|
|
85
81
|
|
|
86
82
|
constructor(private _parentWindow: Window) {
|
|
@@ -95,7 +91,7 @@ class ScreenDprMonitor extends Disposable {
|
|
|
95
91
|
this._setWindowResizeListener();
|
|
96
92
|
|
|
97
93
|
// Setup additional disposables
|
|
98
|
-
this.
|
|
94
|
+
this._register(toDisposable(() => this.clearListener()));
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
|
|
@@ -106,7 +102,7 @@ class ScreenDprMonitor extends Disposable {
|
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
private _setWindowResizeListener(): void {
|
|
109
|
-
this._windowResizeListener.value =
|
|
105
|
+
this._windowResizeListener.value = addDisposableListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers());
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
private _setDprAndFireIfDiffers(): void {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILinkProvider, ILinkProviderService } from 'browser/services/Services';
|
|
2
|
-
import { Disposable, toDisposable } from 'common/
|
|
2
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
3
3
|
import { IDisposable } from 'common/Types';
|
|
4
4
|
|
|
5
5
|
export class LinkProviderService extends Disposable implements ILinkProviderService {
|
|
@@ -9,7 +9,7 @@ export class LinkProviderService extends Disposable implements ILinkProviderServ
|
|
|
9
9
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super();
|
|
12
|
-
this.
|
|
12
|
+
this._register(toDisposable(() => this.linkProviders.length = 0));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {
|
|
@@ -7,7 +7,7 @@ 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 { Disposable, MutableDisposable, toDisposable } from 'common/
|
|
10
|
+
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
11
11
|
import { DebouncedIdleTask } from 'common/TaskQueue';
|
|
12
12
|
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
|
|
13
13
|
import { Emitter } from 'vs/base/common/event';
|
|
@@ -21,10 +21,10 @@ interface ISelectionState {
|
|
|
21
21
|
export class RenderService extends Disposable implements IRenderService {
|
|
22
22
|
public serviceBrand: undefined;
|
|
23
23
|
|
|
24
|
-
private _renderer: MutableDisposable<IRenderer> = this.
|
|
24
|
+
private _renderer: MutableDisposable<IRenderer> = this._register(new MutableDisposable());
|
|
25
25
|
private _renderDebouncer: IRenderDebouncerWithCallback;
|
|
26
26
|
private _pausedResizeTask = new DebouncedIdleTask();
|
|
27
|
-
private _observerDisposable = this.
|
|
27
|
+
private _observerDisposable = this._register(new MutableDisposable());
|
|
28
28
|
|
|
29
29
|
private _isPaused: boolean = false;
|
|
30
30
|
private _needsFullRefresh: boolean = false;
|
|
@@ -38,13 +38,13 @@ export class RenderService extends Disposable implements IRenderService {
|
|
|
38
38
|
columnSelectMode: false
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
private readonly _onDimensionsChange = this.
|
|
41
|
+
private readonly _onDimensionsChange = this._register(new Emitter<IRenderDimensions>());
|
|
42
42
|
public readonly onDimensionsChange = this._onDimensionsChange.event;
|
|
43
|
-
private readonly _onRenderedViewportChange = this.
|
|
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.
|
|
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.
|
|
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; }
|
|
@@ -62,23 +62,23 @@ export class RenderService extends Disposable implements IRenderService {
|
|
|
62
62
|
super();
|
|
63
63
|
|
|
64
64
|
this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end), coreBrowserService);
|
|
65
|
-
this.
|
|
65
|
+
this._register(this._renderDebouncer);
|
|
66
66
|
|
|
67
|
-
this.
|
|
67
|
+
this._register(coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange()));
|
|
68
68
|
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
69
|
+
this._register(bufferService.onResize(() => this._fullRefresh()));
|
|
70
|
+
this._register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear()));
|
|
71
|
+
this._register(optionsService.onOptionChange(() => this._handleOptionsChanged()));
|
|
72
|
+
this._register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));
|
|
73
73
|
|
|
74
74
|
// Do a full refresh whenever any decoration is added or removed. This may not actually result
|
|
75
75
|
// in changes but since decorations should be used sparingly or added/removed all in the same
|
|
76
76
|
// frame this should have minimal performance impact.
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
77
|
+
this._register(decorationService.onDecorationRegistered(() => this._fullRefresh()));
|
|
78
|
+
this._register(decorationService.onDecorationRemoved(() => this._fullRefresh()));
|
|
79
79
|
|
|
80
80
|
// Clear the renderer when the a change that could affect glyphs occurs
|
|
81
|
-
this.
|
|
81
|
+
this._register(optionsService.onMultipleOptionChange([
|
|
82
82
|
'customGlyphs',
|
|
83
83
|
'drawBoldTextInBrightColors',
|
|
84
84
|
'letterSpacing',
|
|
@@ -96,15 +96,15 @@ export class RenderService extends Disposable implements IRenderService {
|
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
98
|
// Refresh the cursor line when the cursor changes
|
|
99
|
-
this.
|
|
99
|
+
this._register(optionsService.onMultipleOptionChange([
|
|
100
100
|
'cursorBlink',
|
|
101
101
|
'cursorStyle'
|
|
102
102
|
], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true)));
|
|
103
103
|
|
|
104
|
-
this.
|
|
104
|
+
this._register(themeService.onChangeColors(() => this._fullRefresh()));
|
|
105
105
|
|
|
106
106
|
this._registerIntersectionObserver(coreBrowserService.window, screenElement);
|
|
107
|
-
this.
|
|
107
|
+
this._register(coreBrowserService.onWindowChange((w) => this._registerIntersectionObserver(w, screenElement)));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
private _registerIntersectionObserver(w: Window & typeof globalThis, screenElement: HTMLElement): void {
|
|
@@ -9,7 +9,7 @@ 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 { Disposable, toDisposable } from 'common/
|
|
12
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
13
13
|
import * as Browser from 'common/Platform';
|
|
14
14
|
import { IBufferLine, IDisposable } from 'common/Types';
|
|
15
15
|
import { getRangeLength } from 'common/buffer/BufferRange';
|
|
@@ -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.
|
|
114
|
+
private readonly _onLinuxMouseSelection = this._register(new Emitter<string>());
|
|
115
115
|
public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;
|
|
116
|
-
private readonly _onRedrawRequest = this.
|
|
116
|
+
private readonly _onRedrawRequest = this._register(new Emitter<ISelectionRedrawRequestEvent>());
|
|
117
117
|
public readonly onRequestRedraw = this._onRedrawRequest.event;
|
|
118
|
-
private readonly _onSelectionChange = this.
|
|
118
|
+
private readonly _onSelectionChange = this._register(new Emitter<void>());
|
|
119
119
|
public readonly onSelectionChange = this._onSelectionChange.event;
|
|
120
|
-
private readonly _onRequestScrollLines = this.
|
|
120
|
+
private readonly _onRequestScrollLines = this._register(new Emitter<ISelectionRequestScrollLinesEvent>());
|
|
121
121
|
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
|
|
122
122
|
|
|
123
123
|
constructor(
|
|
@@ -142,14 +142,14 @@ export class SelectionService extends Disposable implements ISelectionService {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));
|
|
145
|
-
this.
|
|
145
|
+
this._register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));
|
|
146
146
|
|
|
147
147
|
this.enable();
|
|
148
148
|
|
|
149
149
|
this._model = new SelectionModel(this._bufferService);
|
|
150
150
|
this._activeSelectionMode = SelectionMode.NORMAL;
|
|
151
151
|
|
|
152
|
-
this.
|
|
152
|
+
this._register(toDisposable(() => {
|
|
153
153
|
this._removeMouseDownListeners();
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
@@ -7,7 +7,7 @@ import { ColorContrastCache } from 'browser/ColorContrastCache';
|
|
|
7
7
|
import { IThemeService } from 'browser/services/Services';
|
|
8
8
|
import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
9
9
|
import { color, css, NULL_COLOR } from 'common/Color';
|
|
10
|
-
import { Disposable } from 'common/
|
|
10
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
11
11
|
import { IOptionsService, ITheme } from 'common/services/Services';
|
|
12
12
|
import { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';
|
|
13
13
|
import { Emitter } from 'vs/base/common/event';
|
|
@@ -40,7 +40,7 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
40
40
|
|
|
41
41
|
public get colors(): ReadonlyColorSet { return this._colors; }
|
|
42
42
|
|
|
43
|
-
private readonly _onChangeColors = this.
|
|
43
|
+
private readonly _onChangeColors = this._register(new Emitter<ReadonlyColorSet>());
|
|
44
44
|
public readonly onChangeColors = this._onChangeColors.event;
|
|
45
45
|
|
|
46
46
|
constructor(
|
|
@@ -69,8 +69,8 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
69
69
|
this._updateRestoreColors();
|
|
70
70
|
this._setTheme(this._optionsService.rawOptions.theme);
|
|
71
71
|
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
72
|
+
this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));
|
|
73
|
+
this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ICircularList } from 'common/Types';
|
|
7
|
-
import { Disposable } from 'common/
|
|
7
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
8
8
|
import { Emitter } from 'vs/base/common/event';
|
|
9
9
|
|
|
10
10
|
export interface IInsertEvent {
|
|
@@ -26,11 +26,11 @@ export class CircularList<T> extends Disposable implements ICircularList<T> {
|
|
|
26
26
|
private _startIndex: number;
|
|
27
27
|
private _length: number;
|
|
28
28
|
|
|
29
|
-
public readonly onDeleteEmitter = this.
|
|
29
|
+
public readonly onDeleteEmitter = this._register(new Emitter<IDeleteEvent>());
|
|
30
30
|
public readonly onDelete = this.onDeleteEmitter.event;
|
|
31
|
-
public readonly onInsertEmitter = this.
|
|
31
|
+
public readonly onInsertEmitter = this._register(new Emitter<IInsertEvent>());
|
|
32
32
|
public readonly onInsert = this.onInsertEmitter.event;
|
|
33
|
-
public readonly onTrimEmitter = this.
|
|
33
|
+
public readonly onTrimEmitter = this._register(new Emitter<number>());
|
|
34
34
|
public readonly onTrim = this.onTrimEmitter.event;
|
|
35
35
|
|
|
36
36
|
constructor(
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
* http://linux.die.net/man/7/urxvt
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
|
25
24
|
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';
|
|
26
25
|
import { InstantiationService } from 'common/services/InstantiationService';
|
|
27
26
|
import { LogService } from 'common/services/LogService';
|
|
@@ -39,6 +38,7 @@ import { InputHandler } from 'common/InputHandler';
|
|
|
39
38
|
import { WriteBuffer } from 'common/input/WriteBuffer';
|
|
40
39
|
import { OscLinkService } from 'common/services/OscLinkService';
|
|
41
40
|
import { Emitter, Event } from 'vs/base/common/event';
|
|
41
|
+
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
42
42
|
|
|
43
43
|
// Only trigger this warning a single time per session
|
|
44
44
|
let hasWriteSyncWarnHappened = false;
|
|
@@ -57,17 +57,17 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
57
57
|
|
|
58
58
|
protected _inputHandler: InputHandler;
|
|
59
59
|
private _writeBuffer: WriteBuffer;
|
|
60
|
-
private _windowsWrappingHeuristics = this.
|
|
60
|
+
private _windowsWrappingHeuristics = this._register(new MutableDisposable());
|
|
61
61
|
|
|
62
|
-
private readonly _onBinary = this.
|
|
62
|
+
private readonly _onBinary = this._register(new Emitter<string>());
|
|
63
63
|
public readonly onBinary = this._onBinary.event;
|
|
64
|
-
private readonly _onData = this.
|
|
64
|
+
private readonly _onData = this._register(new Emitter<string>());
|
|
65
65
|
public readonly onData = this._onData.event;
|
|
66
|
-
protected _onLineFeed = this.
|
|
66
|
+
protected _onLineFeed = this._register(new Emitter<void>());
|
|
67
67
|
public readonly onLineFeed = this._onLineFeed.event;
|
|
68
|
-
private readonly _onResize = this.
|
|
68
|
+
private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());
|
|
69
69
|
public readonly onResize = this._onResize.event;
|
|
70
|
-
protected readonly _onWriteParsed = this.
|
|
70
|
+
protected readonly _onWriteParsed = this._register(new Emitter<void>());
|
|
71
71
|
public readonly onWriteParsed = this._onWriteParsed.event;
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -75,10 +75,10 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
75
75
|
* it's filtered out.
|
|
76
76
|
*/
|
|
77
77
|
protected _onScrollApi?: Emitter<number>;
|
|
78
|
-
protected _onScroll = this.
|
|
78
|
+
protected _onScroll = this._register(new Emitter<IScrollEvent>());
|
|
79
79
|
public get onScroll(): Event<number> {
|
|
80
80
|
if (!this._onScrollApi) {
|
|
81
|
-
this._onScrollApi = this.
|
|
81
|
+
this._onScrollApi = this._register(new Emitter<number>());
|
|
82
82
|
this._onScroll.event(ev => {
|
|
83
83
|
this._onScrollApi?.fire(ev.position);
|
|
84
84
|
});
|
|
@@ -103,17 +103,17 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
103
103
|
|
|
104
104
|
// Setup and initialize services
|
|
105
105
|
this._instantiationService = new InstantiationService();
|
|
106
|
-
this.optionsService = this.
|
|
106
|
+
this.optionsService = this._register(new OptionsService(options));
|
|
107
107
|
this._instantiationService.setService(IOptionsService, this.optionsService);
|
|
108
|
-
this._bufferService = this.
|
|
108
|
+
this._bufferService = this._register(this._instantiationService.createInstance(BufferService));
|
|
109
109
|
this._instantiationService.setService(IBufferService, this._bufferService);
|
|
110
|
-
this._logService = this.
|
|
110
|
+
this._logService = this._register(this._instantiationService.createInstance(LogService));
|
|
111
111
|
this._instantiationService.setService(ILogService, this._logService);
|
|
112
|
-
this.coreService = this.
|
|
112
|
+
this.coreService = this._register(this._instantiationService.createInstance(CoreService));
|
|
113
113
|
this._instantiationService.setService(ICoreService, this.coreService);
|
|
114
|
-
this.coreMouseService = this.
|
|
114
|
+
this.coreMouseService = this._register(this._instantiationService.createInstance(CoreMouseService));
|
|
115
115
|
this._instantiationService.setService(ICoreMouseService, this.coreMouseService);
|
|
116
|
-
this.unicodeService = this.
|
|
116
|
+
this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));
|
|
117
117
|
this._instantiationService.setService(IUnicodeService, this.unicodeService);
|
|
118
118
|
this._charsetService = this._instantiationService.createInstance(CharsetService);
|
|
119
119
|
this._instantiationService.setService(ICharsetService, this._charsetService);
|
|
@@ -122,24 +122,24 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
// Register input handler and handle/forward events
|
|
125
|
-
this._inputHandler = this.
|
|
126
|
-
this.
|
|
127
|
-
this.
|
|
125
|
+
this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));
|
|
126
|
+
this._register(Event.forward(this._inputHandler.onLineFeed, this._onLineFeed));
|
|
127
|
+
this._register(this._inputHandler);
|
|
128
128
|
|
|
129
129
|
// Setup listeners
|
|
130
|
-
this.
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
136
|
-
this.
|
|
130
|
+
this._register(Event.forward(this._bufferService.onResize, this._onResize));
|
|
131
|
+
this._register(Event.forward(this.coreService.onData, this._onData));
|
|
132
|
+
this._register(Event.forward(this.coreService.onBinary, this._onBinary));
|
|
133
|
+
this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));
|
|
134
|
+
this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));
|
|
135
|
+
this._register(this.optionsService.onMultipleOptionChange(['windowsMode', 'windowsPty'], () => this._handleWindowsPtyOptionChange()));
|
|
136
|
+
this._register(this._bufferService.onScroll(() => {
|
|
137
137
|
this._onScroll.fire({ position: this._bufferService.buffer.ydisp });
|
|
138
138
|
this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
|
|
139
139
|
}));
|
|
140
140
|
// Setup WriteBuffer
|
|
141
|
-
this._writeBuffer = this.
|
|
142
|
-
this.
|
|
141
|
+
this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));
|
|
142
|
+
this._register(Event.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
public write(data: string | Uint8Array, callback?: () => void): void {
|