@xterm/xterm 5.6.0-beta.5 → 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/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 +53 -25
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +132 -144
- package/src/browser/Linkifier.ts +15 -13
- 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 +14 -9
- package/src/browser/decorations/OverviewRulerRenderer.ts +40 -44
- package/src/browser/public/Terminal.ts +25 -19
- package/src/browser/renderer/dom/DomRenderer.ts +14 -16
- package/src/browser/renderer/shared/CharAtlasUtils.ts +4 -0
- package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
- package/src/browser/renderer/shared/DevicePixelObserver.ts +1 -2
- 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 +6 -6
- package/src/browser/services/CoreBrowserService.ts +15 -15
- package/src/browser/services/LinkProviderService.ts +2 -2
- package/src/browser/services/RenderService.ts +20 -20
- package/src/browser/services/SelectionService.ts +8 -8
- package/src/browser/services/Services.ts +13 -13
- package/src/browser/services/ThemeService.ts +17 -56
- package/src/browser/shared/Constants.ts +8 -0
- package/src/common/CircularList.ts +5 -5
- package/src/common/CoreTerminal.ts +35 -41
- package/src/common/InputHandler.ts +34 -28
- package/src/common/{Types.d.ts → Types.ts} +11 -17
- package/src/common/buffer/Buffer.ts +5 -1
- package/src/common/buffer/BufferSet.ts +5 -5
- package/src/common/buffer/Marker.ts +4 -4
- package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
- package/src/common/input/WriteBuffer.ts +3 -3
- package/src/common/parser/EscapeSequenceParser.ts +4 -4
- package/src/common/public/BufferNamespaceApi.ts +3 -3
- package/src/common/services/BufferService.ts +7 -7
- package/src/common/services/CoreMouseService.ts +5 -3
- package/src/common/services/CoreService.ts +6 -6
- package/src/common/services/DecorationService.ts +8 -9
- package/src/common/services/LogService.ts +2 -2
- package/src/common/services/OptionsService.ts +5 -5
- 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/browser/Lifecycle.ts +0 -33
- package/src/common/EventEmitter.ts +0 -78
- package/src/common/Lifecycle.ts +0 -108
- /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
- /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
|
@@ -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 {
|
|
11
|
-
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
|
|
10
|
+
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/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;
|
|
@@ -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,14 +9,14 @@ 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 {
|
|
13
|
-
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
12
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
14
13
|
import * as Browser from 'common/Platform';
|
|
15
14
|
import { IBufferLine, IDisposable } from 'common/Types';
|
|
16
15
|
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.
|
|
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
|
}
|
|
@@ -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
|
/**
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
import { ColorContrastCache } from 'browser/ColorContrastCache';
|
|
7
7
|
import { IThemeService } from 'browser/services/Services';
|
|
8
|
-
import { IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Disposable } from 'common/Lifecycle';
|
|
8
|
+
import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
9
|
+
import { color, css, NULL_COLOR } from 'common/Color';
|
|
10
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
12
11
|
import { IOptionsService, ITheme } from 'common/services/Services';
|
|
13
12
|
import { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';
|
|
13
|
+
import { Emitter } from 'vs/base/common/event';
|
|
14
14
|
|
|
15
15
|
interface IRestoreColorSet {
|
|
16
16
|
foreground: IColor;
|
|
@@ -23,59 +23,12 @@ interface IRestoreColorSet {
|
|
|
23
23
|
const DEFAULT_FOREGROUND = css.toColor('#ffffff');
|
|
24
24
|
const DEFAULT_BACKGROUND = css.toColor('#000000');
|
|
25
25
|
const DEFAULT_CURSOR = css.toColor('#ffffff');
|
|
26
|
-
const DEFAULT_CURSOR_ACCENT =
|
|
26
|
+
const DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;
|
|
27
27
|
const DEFAULT_SELECTION = {
|
|
28
28
|
css: 'rgba(255, 255, 255, 0.3)',
|
|
29
29
|
rgba: 0xFFFFFF4D
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
// An IIFE to generate DEFAULT_ANSI_COLORS.
|
|
33
|
-
export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
|
|
34
|
-
const colors = [
|
|
35
|
-
// dark:
|
|
36
|
-
css.toColor('#2e3436'),
|
|
37
|
-
css.toColor('#cc0000'),
|
|
38
|
-
css.toColor('#4e9a06'),
|
|
39
|
-
css.toColor('#c4a000'),
|
|
40
|
-
css.toColor('#3465a4'),
|
|
41
|
-
css.toColor('#75507b'),
|
|
42
|
-
css.toColor('#06989a'),
|
|
43
|
-
css.toColor('#d3d7cf'),
|
|
44
|
-
// bright:
|
|
45
|
-
css.toColor('#555753'),
|
|
46
|
-
css.toColor('#ef2929'),
|
|
47
|
-
css.toColor('#8ae234'),
|
|
48
|
-
css.toColor('#fce94f'),
|
|
49
|
-
css.toColor('#729fcf'),
|
|
50
|
-
css.toColor('#ad7fa8'),
|
|
51
|
-
css.toColor('#34e2e2'),
|
|
52
|
-
css.toColor('#eeeeec')
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
// Fill in the remaining 240 ANSI colors.
|
|
56
|
-
// Generate colors (16-231)
|
|
57
|
-
const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
|
|
58
|
-
for (let i = 0; i < 216; i++) {
|
|
59
|
-
const r = v[(i / 36) % 6 | 0];
|
|
60
|
-
const g = v[(i / 6) % 6 | 0];
|
|
61
|
-
const b = v[i % 6];
|
|
62
|
-
colors.push({
|
|
63
|
-
css: channels.toCss(r, g, b),
|
|
64
|
-
rgba: channels.toRgba(r, g, b)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Generate greys (232-255)
|
|
69
|
-
for (let i = 0; i < 24; i++) {
|
|
70
|
-
const c = 8 + i * 10;
|
|
71
|
-
colors.push({
|
|
72
|
-
css: channels.toCss(c, c, c),
|
|
73
|
-
rgba: channels.toRgba(c, c, c)
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return colors;
|
|
78
|
-
})());
|
|
31
|
+
const DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;
|
|
79
32
|
|
|
80
33
|
export class ThemeService extends Disposable implements IThemeService {
|
|
81
34
|
public serviceBrand: undefined;
|
|
@@ -87,7 +40,7 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
87
40
|
|
|
88
41
|
public get colors(): ReadonlyColorSet { return this._colors; }
|
|
89
42
|
|
|
90
|
-
private readonly _onChangeColors = this.
|
|
43
|
+
private readonly _onChangeColors = this._register(new Emitter<ReadonlyColorSet>());
|
|
91
44
|
public readonly onChangeColors = this._onChangeColors.event;
|
|
92
45
|
|
|
93
46
|
constructor(
|
|
@@ -105,6 +58,10 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
105
58
|
selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
|
|
106
59
|
selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,
|
|
107
60
|
selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
|
|
61
|
+
scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),
|
|
62
|
+
scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),
|
|
63
|
+
scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),
|
|
64
|
+
overviewRulerBorder: DEFAULT_FOREGROUND,
|
|
108
65
|
ansi: DEFAULT_ANSI_COLORS.slice(),
|
|
109
66
|
contrastCache: this._contrastCache,
|
|
110
67
|
halfContrastCache: this._halfContrastCache
|
|
@@ -112,8 +69,8 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
112
69
|
this._updateRestoreColors();
|
|
113
70
|
this._setTheme(this._optionsService.rawOptions.theme);
|
|
114
71
|
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
72
|
+
this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));
|
|
73
|
+
this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));
|
|
117
74
|
}
|
|
118
75
|
|
|
119
76
|
/**
|
|
@@ -148,6 +105,10 @@ export class ThemeService extends Disposable implements IThemeService {
|
|
|
148
105
|
const opacity = 0.3;
|
|
149
106
|
colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);
|
|
150
107
|
}
|
|
108
|
+
colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));
|
|
109
|
+
colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));
|
|
110
|
+
colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));
|
|
111
|
+
colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);
|
|
151
112
|
colors.ansi = DEFAULT_ANSI_COLORS.slice();
|
|
152
113
|
colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);
|
|
153
114
|
colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ICircularList } from 'common/Types';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
8
|
+
import { Emitter } from 'vs/base/common/event';
|
|
9
9
|
|
|
10
10
|
export interface IInsertEvent {
|
|
11
11
|
index: number;
|
|
@@ -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,15 +21,13 @@
|
|
|
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';
|
|
28
27
|
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
|
|
29
28
|
import { OptionsService } from 'common/services/OptionsService';
|
|
30
|
-
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent
|
|
29
|
+
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';
|
|
31
30
|
import { CoreService } from 'common/services/CoreService';
|
|
32
|
-
import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
|
|
33
31
|
import { CoreMouseService } from 'common/services/CoreMouseService';
|
|
34
32
|
import { UnicodeService } from 'common/services/UnicodeService';
|
|
35
33
|
import { CharsetService } from 'common/services/CharsetService';
|
|
@@ -39,6 +37,8 @@ import { IBufferSet } from 'common/buffer/Types';
|
|
|
39
37
|
import { InputHandler } from 'common/InputHandler';
|
|
40
38
|
import { WriteBuffer } from 'common/input/WriteBuffer';
|
|
41
39
|
import { OscLinkService } from 'common/services/OscLinkService';
|
|
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,28 +57,28 @@ 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
|
/**
|
|
74
74
|
* Internally we track the source of the scroll but this is meaningless outside the library so
|
|
75
75
|
* it's filtered out.
|
|
76
76
|
*/
|
|
77
|
-
protected _onScrollApi?:
|
|
78
|
-
protected _onScroll = this.
|
|
79
|
-
public get onScroll():
|
|
77
|
+
protected _onScrollApi?: Emitter<number>;
|
|
78
|
+
protected _onScroll = this._register(new Emitter<IScrollEvent>());
|
|
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,29 +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.
|
|
137
|
-
this._onScroll.fire({ position: this._bufferService.buffer.ydisp
|
|
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
|
+
this._onScroll.fire({ position: this._bufferService.buffer.ydisp });
|
|
138
138
|
this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
|
|
139
139
|
}));
|
|
140
|
-
this.register(this._inputHandler.onScroll(event => {
|
|
141
|
-
this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: ScrollSource.TERMINAL });
|
|
142
|
-
this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
|
|
143
|
-
}));
|
|
144
|
-
|
|
145
140
|
// Setup WriteBuffer
|
|
146
|
-
this._writeBuffer = this.
|
|
147
|
-
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));
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
public write(data: string | Uint8Array, callback?: () => void): void {
|
|
@@ -198,10 +193,9 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
198
193
|
* @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid
|
|
199
194
|
* unwanted events being handled by the viewport when the event was triggered from the viewport
|
|
200
195
|
* originally.
|
|
201
|
-
* @param source Which component the event came from.
|
|
202
196
|
*/
|
|
203
|
-
public scrollLines(disp: number, suppressScrollEvent?: boolean
|
|
204
|
-
this._bufferService.scrollLines(disp, suppressScrollEvent
|
|
197
|
+
public scrollLines(disp: number, suppressScrollEvent?: boolean): void {
|
|
198
|
+
this._bufferService.scrollLines(disp, suppressScrollEvent);
|
|
205
199
|
}
|
|
206
200
|
|
|
207
201
|
public scrollPages(pageCount: number): void {
|
|
@@ -212,7 +206,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|
|
212
206
|
this.scrollLines(-this._bufferService.buffer.ydisp);
|
|
213
207
|
}
|
|
214
208
|
|
|
215
|
-
public scrollToBottom(): void {
|
|
209
|
+
public scrollToBottom(disableSmoothScroll?: boolean): void {
|
|
216
210
|
this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
|
|
217
211
|
}
|
|
218
212
|
|