@wendongfly/zihi 1.1.0 → 1.1.2
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/dist/index.js +1 -1
- package/dist/lib/xterm/README.md +27 -14
- package/dist/lib/xterm/css/xterm.css +81 -5
- package/dist/lib/xterm/lib/xterm.js +1 -1
- package/dist/lib/xterm/lib/xterm.js.map +1 -1
- package/dist/lib/xterm/lib/xterm.mjs +53 -0
- package/dist/lib/xterm/lib/xterm.mjs.map +7 -0
- package/dist/lib/xterm/package.json +49 -38
- package/dist/lib/xterm/src/browser/AccessibilityManager.ts +185 -50
- package/dist/lib/xterm/src/browser/CoreBrowserTerminal.ts +1339 -0
- package/dist/lib/xterm/src/browser/Linkifier.ts +403 -0
- package/dist/lib/xterm/src/browser/LocalizableStrings.ts +15 -4
- package/dist/lib/xterm/src/browser/OscLinkProvider.ts +2 -1
- package/dist/lib/xterm/src/browser/RenderDebouncer.ts +6 -5
- package/dist/lib/xterm/src/browser/TimeBasedDebouncer.ts +2 -2
- package/dist/lib/xterm/src/browser/Types.ts +226 -0
- package/dist/lib/xterm/src/browser/Viewport.ts +148 -357
- package/dist/lib/xterm/src/browser/decorations/BufferDecorationRenderer.ts +17 -12
- package/dist/lib/xterm/src/browser/decorations/OverviewRulerRenderer.ts +47 -52
- package/dist/lib/xterm/src/browser/input/CompositionHelper.ts +5 -3
- package/dist/lib/xterm/src/browser/input/MoveToCell.ts +3 -1
- package/dist/lib/xterm/src/browser/public/Terminal.ts +39 -24
- package/dist/lib/xterm/src/browser/renderer/dom/DomRenderer.ts +76 -40
- package/dist/lib/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +47 -23
- package/dist/lib/xterm/src/browser/renderer/dom/WidthCache.ts +19 -9
- package/dist/lib/xterm/src/browser/renderer/shared/Constants.ts +0 -8
- package/dist/lib/xterm/src/browser/renderer/shared/RendererUtils.ts +38 -1
- package/dist/lib/xterm/src/browser/renderer/shared/SelectionRenderModel.ts +6 -4
- package/dist/lib/xterm/src/browser/renderer/shared/Types.ts +84 -0
- package/dist/lib/xterm/src/browser/selection/Types.ts +15 -0
- package/dist/lib/xterm/src/browser/services/CharSizeService.ts +57 -32
- package/dist/lib/xterm/src/browser/services/CoreBrowserService.ts +108 -4
- package/dist/lib/xterm/src/browser/services/LinkProviderService.ts +28 -0
- package/dist/lib/xterm/src/browser/services/RenderService.ts +132 -40
- package/dist/lib/xterm/src/browser/services/SelectionService.ts +19 -9
- package/dist/lib/xterm/src/browser/services/Services.ts +36 -16
- package/dist/lib/xterm/src/browser/services/ThemeService.ts +19 -58
- package/dist/lib/xterm/src/browser/shared/Constants.ts +8 -0
- package/dist/lib/xterm/src/common/CircularList.ts +5 -5
- package/dist/lib/xterm/src/common/Color.ts +34 -14
- package/dist/lib/xterm/src/common/CoreTerminal.ts +40 -41
- package/dist/lib/xterm/src/common/InputHandler.ts +177 -125
- package/dist/lib/xterm/src/common/Platform.ts +2 -1
- package/dist/lib/xterm/src/common/SortedList.ts +86 -10
- package/dist/lib/xterm/src/common/TaskQueue.ts +7 -7
- package/dist/lib/xterm/src/common/Types.ts +552 -0
- package/dist/lib/xterm/src/common/buffer/AttributeData.ts +15 -0
- package/dist/lib/xterm/src/common/buffer/Buffer.ts +15 -7
- package/dist/lib/xterm/src/common/buffer/BufferLine.ts +53 -22
- package/dist/lib/xterm/src/common/buffer/BufferRange.ts +1 -1
- package/dist/lib/xterm/src/common/buffer/BufferReflow.ts +9 -6
- package/dist/lib/xterm/src/common/buffer/BufferSet.ts +5 -5
- package/dist/lib/xterm/src/common/buffer/Constants.ts +10 -2
- package/dist/lib/xterm/src/common/buffer/Marker.ts +4 -4
- package/dist/lib/xterm/src/common/buffer/Types.ts +52 -0
- package/dist/lib/xterm/src/common/input/Keyboard.ts +2 -27
- package/dist/lib/xterm/src/common/input/UnicodeV6.ts +18 -5
- package/dist/lib/xterm/src/common/input/WriteBuffer.ts +9 -8
- package/dist/lib/xterm/src/common/parser/EscapeSequenceParser.ts +13 -13
- package/dist/lib/xterm/src/common/parser/Types.ts +275 -0
- package/dist/lib/xterm/src/common/public/AddonManager.ts +1 -1
- package/dist/lib/xterm/src/common/public/BufferApiView.ts +1 -1
- package/dist/lib/xterm/src/common/public/BufferLineApiView.ts +1 -1
- package/dist/lib/xterm/src/common/public/BufferNamespaceApi.ts +4 -4
- package/dist/lib/xterm/src/common/public/ParserApi.ts +1 -1
- package/dist/lib/xterm/src/common/public/UnicodeApi.ts +1 -1
- package/dist/lib/xterm/src/common/services/BufferService.ts +14 -11
- package/dist/lib/xterm/src/common/services/CoreMouseService.ts +53 -6
- package/dist/lib/xterm/src/common/services/CoreService.ts +13 -8
- package/dist/lib/xterm/src/common/services/DecorationService.ts +11 -11
- package/dist/lib/xterm/src/common/services/InstantiationService.ts +1 -1
- package/dist/lib/xterm/src/common/services/LogService.ts +2 -2
- package/dist/lib/xterm/src/common/services/OptionsService.ts +16 -5
- package/dist/lib/xterm/src/common/services/ServiceRegistry.ts +1 -1
- package/dist/lib/xterm/src/common/services/Services.ts +73 -19
- package/dist/lib/xterm/src/common/services/UnicodeService.ts +30 -5
- package/dist/lib/xterm/src/vs/base/browser/browser.ts +141 -0
- package/dist/lib/xterm/src/vs/base/browser/canIUse.ts +49 -0
- package/dist/lib/xterm/src/vs/base/browser/dom.ts +2369 -0
- package/dist/lib/xterm/src/vs/base/browser/fastDomNode.ts +316 -0
- package/dist/lib/xterm/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/dist/lib/xterm/src/vs/base/browser/iframe.ts +135 -0
- package/dist/lib/xterm/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/dist/lib/xterm/src/vs/base/browser/mouseEvent.ts +229 -0
- package/dist/lib/xterm/src/vs/base/browser/touch.ts +372 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/dist/lib/xterm/src/vs/base/browser/ui/widget.ts +57 -0
- package/dist/lib/xterm/src/vs/base/browser/window.ts +14 -0
- package/dist/lib/xterm/src/vs/base/common/arrays.ts +887 -0
- package/dist/lib/xterm/src/vs/base/common/arraysFind.ts +202 -0
- package/dist/lib/xterm/src/vs/base/common/assert.ts +71 -0
- package/dist/lib/xterm/src/vs/base/common/async.ts +1992 -0
- package/dist/lib/xterm/src/vs/base/common/cancellation.ts +148 -0
- package/dist/lib/xterm/src/vs/base/common/charCode.ts +450 -0
- package/dist/lib/xterm/src/vs/base/common/collections.ts +140 -0
- package/dist/lib/xterm/src/vs/base/common/decorators.ts +130 -0
- package/dist/lib/xterm/src/vs/base/common/equals.ts +146 -0
- package/dist/lib/xterm/src/vs/base/common/errors.ts +303 -0
- package/dist/lib/xterm/src/vs/base/common/event.ts +1778 -0
- package/dist/lib/xterm/src/vs/base/common/functional.ts +32 -0
- package/dist/lib/xterm/src/vs/base/common/hash.ts +316 -0
- package/dist/lib/xterm/src/vs/base/common/iterator.ts +159 -0
- package/dist/lib/xterm/src/vs/base/common/keyCodes.ts +526 -0
- package/dist/lib/xterm/src/vs/base/common/keybindings.ts +284 -0
- package/dist/lib/xterm/src/vs/base/common/lazy.ts +47 -0
- package/dist/lib/xterm/src/vs/base/common/lifecycle.ts +801 -0
- package/dist/lib/xterm/src/vs/base/common/linkedList.ts +142 -0
- package/dist/lib/xterm/src/vs/base/common/map.ts +202 -0
- package/dist/lib/xterm/src/vs/base/common/numbers.ts +98 -0
- package/dist/lib/xterm/src/vs/base/common/observable.ts +76 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/api.ts +31 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/base.ts +489 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/dist/lib/xterm/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/dist/lib/xterm/src/vs/base/common/platform.ts +281 -0
- package/dist/lib/xterm/src/vs/base/common/scrollable.ts +522 -0
- package/dist/lib/xterm/src/vs/base/common/sequence.ts +34 -0
- package/dist/lib/xterm/src/vs/base/common/stopwatch.ts +43 -0
- package/dist/lib/xterm/src/vs/base/common/strings.ts +557 -0
- package/dist/lib/xterm/src/vs/base/common/symbols.ts +9 -0
- package/dist/lib/xterm/src/vs/base/common/uint.ts +59 -0
- package/dist/lib/xterm/src/vs/patches/nls.ts +90 -0
- package/dist/lib/xterm/src/vs/typings/base-common.d.ts +20 -0
- package/dist/lib/xterm/src/vs/typings/require.d.ts +42 -0
- package/dist/lib/xterm/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/dist/lib/xterm/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/dist/lib/xterm/typings/xterm.d.ts +156 -43
- package/dist/lib/xterm-fit/README.md +5 -5
- package/dist/lib/xterm-fit/lib/addon-fit.js +2 -0
- package/dist/lib/xterm-fit/lib/addon-fit.js.map +1 -0
- package/dist/lib/xterm-fit/lib/addon-fit.mjs +18 -0
- package/dist/lib/xterm-fit/lib/addon-fit.mjs.map +7 -0
- package/dist/lib/xterm-fit/package.json +9 -9
- package/dist/lib/xterm-fit/src/FitAddon.ts +7 -4
- package/dist/lib/xterm-fit/typings/addon-fit.d.ts +55 -0
- package/dist/lib/xterm-links/README.md +5 -5
- package/dist/lib/xterm-links/lib/addon-web-links.js +2 -0
- package/dist/lib/xterm-links/lib/addon-web-links.js.map +1 -0
- package/dist/lib/xterm-links/lib/addon-web-links.mjs +18 -0
- package/dist/lib/xterm-links/lib/addon-web-links.mjs.map +7 -0
- package/dist/lib/xterm-links/package.json +9 -9
- package/dist/lib/xterm-links/src/WebLinkProvider.ts +16 -15
- package/dist/lib/xterm-links/src/WebLinksAddon.ts +4 -3
- package/dist/lib/xterm-links/typings/addon-web-links.d.ts +57 -0
- package/package.json +5 -6
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { Disposable } from 'common/Lifecycle';
|
|
6
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
8
7
|
import { isMac } from 'common/Platform';
|
|
9
8
|
import { CursorStyle, IDisposable } from 'common/Types';
|
|
10
9
|
import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
|
|
10
|
+
import { Emitter } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
13
13
|
cols: 80,
|
|
@@ -18,9 +18,10 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
18
18
|
cursorInactiveStyle: 'outline',
|
|
19
19
|
customGlyphs: true,
|
|
20
20
|
drawBoldTextInBrightColors: true,
|
|
21
|
+
documentOverride: null,
|
|
21
22
|
fastScrollModifier: 'alt',
|
|
22
23
|
fastScrollSensitivity: 5,
|
|
23
|
-
fontFamily: '
|
|
24
|
+
fontFamily: 'monospace',
|
|
24
25
|
fontSize: 15,
|
|
25
26
|
fontWeight: 'normal',
|
|
26
27
|
fontWeightBold: 'bold',
|
|
@@ -31,6 +32,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
31
32
|
logLevel: 'info',
|
|
32
33
|
logger: null,
|
|
33
34
|
scrollback: 1000,
|
|
35
|
+
scrollOnEraseInDisplay: false,
|
|
34
36
|
scrollOnUserInput: true,
|
|
35
37
|
scrollSensitivity: 1,
|
|
36
38
|
screenReaderMode: false,
|
|
@@ -43,6 +45,8 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
43
45
|
allowTransparency: false,
|
|
44
46
|
tabStopWidth: 8,
|
|
45
47
|
theme: {},
|
|
48
|
+
reflowCursorLine: false,
|
|
49
|
+
rescaleOverlappingGlyphs: false,
|
|
46
50
|
rightClickSelectsWord: isMac,
|
|
47
51
|
windowOptions: {},
|
|
48
52
|
windowsMode: false,
|
|
@@ -52,7 +56,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
52
56
|
convertEol: false,
|
|
53
57
|
termName: 'xterm',
|
|
54
58
|
cancelEvents: false,
|
|
55
|
-
|
|
59
|
+
overviewRuler: {}
|
|
56
60
|
};
|
|
57
61
|
|
|
58
62
|
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
|
|
@@ -63,7 +67,7 @@ export class OptionsService extends Disposable implements IOptionsService {
|
|
|
63
67
|
public readonly rawOptions: Required<ITerminalOptions>;
|
|
64
68
|
public options: Required<ITerminalOptions>;
|
|
65
69
|
|
|
66
|
-
private readonly _onOptionChange = this.
|
|
70
|
+
private readonly _onOptionChange = this._register(new Emitter<keyof ITerminalOptions>());
|
|
67
71
|
public readonly onOptionChange = this._onOptionChange.event;
|
|
68
72
|
|
|
69
73
|
constructor(options: Partial<ITerminalOptions>) {
|
|
@@ -85,6 +89,13 @@ export class OptionsService extends Disposable implements IOptionsService {
|
|
|
85
89
|
this.rawOptions = defaultOptions;
|
|
86
90
|
this.options = { ... defaultOptions };
|
|
87
91
|
this._setupOptions();
|
|
92
|
+
|
|
93
|
+
// Clear out options that could link outside xterm.js as they could easily cause an embedder
|
|
94
|
+
// memory leak
|
|
95
|
+
this._register(toDisposable(() => {
|
|
96
|
+
this.rawOptions.linkHandler = null;
|
|
97
|
+
this.rawOptions.documentOverride = null;
|
|
98
|
+
}));
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';
|
|
7
|
+
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
|
7
8
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
|
8
|
-
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColor, CursorStyle, CursorInactiveStyle, IOscLinkData } from 'common/Types';
|
|
9
9
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
|
10
|
-
import {
|
|
10
|
+
import type { Emitter, Event } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
|
13
13
|
export interface IBufferService {
|
|
@@ -18,16 +18,25 @@ export interface IBufferService {
|
|
|
18
18
|
readonly buffer: IBuffer;
|
|
19
19
|
readonly buffers: IBufferSet;
|
|
20
20
|
isUserScrolling: boolean;
|
|
21
|
-
onResize:
|
|
22
|
-
onScroll:
|
|
21
|
+
onResize: Event<IBufferResizeEvent>;
|
|
22
|
+
onScroll: Event<number>;
|
|
23
23
|
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
|
24
|
-
scrollLines(disp: number, suppressScrollEvent?: boolean
|
|
24
|
+
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
|
25
25
|
resize(cols: number, rows: number): void;
|
|
26
26
|
reset(): void;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface IBufferResizeEvent {
|
|
30
|
+
cols: number;
|
|
31
|
+
rows: number;
|
|
32
|
+
colsChanged: boolean;
|
|
33
|
+
rowsChanged: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
export const ICoreMouseService = createDecorator<ICoreMouseService>('CoreMouseService');
|
|
30
37
|
export interface ICoreMouseService {
|
|
38
|
+
serviceBrand: undefined;
|
|
39
|
+
|
|
31
40
|
activeProtocol: string;
|
|
32
41
|
activeEncoding: string;
|
|
33
42
|
areMouseEventsActive: boolean;
|
|
@@ -50,12 +59,17 @@ export interface ICoreMouseService {
|
|
|
50
59
|
/**
|
|
51
60
|
* Event to announce changes in mouse tracking.
|
|
52
61
|
*/
|
|
53
|
-
onProtocolChange:
|
|
62
|
+
onProtocolChange: Event<CoreMouseEventType>;
|
|
54
63
|
|
|
55
64
|
/**
|
|
56
65
|
* Human readable version of mouse events.
|
|
57
66
|
*/
|
|
58
67
|
explainEvents(events: CoreMouseEventType): { [event: string]: boolean };
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Process wheel event taking partial scroll into account.
|
|
71
|
+
*/
|
|
72
|
+
consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number;
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
export const ICoreService = createDecorator<ICoreService>('CoreService');
|
|
@@ -72,10 +86,10 @@ export interface ICoreService {
|
|
|
72
86
|
readonly modes: IModes;
|
|
73
87
|
readonly decPrivateModes: IDecPrivateModes;
|
|
74
88
|
|
|
75
|
-
readonly onData:
|
|
76
|
-
readonly onUserInput:
|
|
77
|
-
readonly onBinary:
|
|
78
|
-
readonly onRequestScrollToBottom:
|
|
89
|
+
readonly onData: Event<string>;
|
|
90
|
+
readonly onUserInput: Event<void>;
|
|
91
|
+
readonly onBinary: Event<string>;
|
|
92
|
+
readonly onRequestScrollToBottom: Event<void>;
|
|
79
93
|
|
|
80
94
|
reset(): void;
|
|
81
95
|
|
|
@@ -122,6 +136,7 @@ export interface ICharsetService {
|
|
|
122
136
|
export interface IServiceIdentifier<T> {
|
|
123
137
|
(...args: any[]): void;
|
|
124
138
|
type: T;
|
|
139
|
+
_id: string;
|
|
125
140
|
}
|
|
126
141
|
|
|
127
142
|
export interface IBrandedService {
|
|
@@ -184,7 +199,7 @@ export interface IOptionsService {
|
|
|
184
199
|
/**
|
|
185
200
|
* Adds an event listener for when any option changes.
|
|
186
201
|
*/
|
|
187
|
-
readonly onOptionChange:
|
|
202
|
+
readonly onOptionChange: Event<keyof ITerminalOptions>;
|
|
188
203
|
|
|
189
204
|
/**
|
|
190
205
|
* Adds an event listener for when a specific option changes, this is a convenience method that is
|
|
@@ -217,7 +232,9 @@ export interface ITerminalOptions {
|
|
|
217
232
|
cursorInactiveStyle?: CursorInactiveStyle;
|
|
218
233
|
customGlyphs?: boolean;
|
|
219
234
|
disableStdin?: boolean;
|
|
235
|
+
documentOverride?: any | null;
|
|
220
236
|
drawBoldTextInBrightColors?: boolean;
|
|
237
|
+
/** @deprecated No longer supported */
|
|
221
238
|
fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
|
|
222
239
|
fastScrollSensitivity?: number;
|
|
223
240
|
fontSize?: number;
|
|
@@ -233,6 +250,8 @@ export interface ITerminalOptions {
|
|
|
233
250
|
macOptionIsMeta?: boolean;
|
|
234
251
|
macOptionClickForcesSelection?: boolean;
|
|
235
252
|
minimumContrastRatio?: number;
|
|
253
|
+
reflowCursorLine?: boolean;
|
|
254
|
+
rescaleOverlappingGlyphs?: boolean;
|
|
236
255
|
rightClickSelectsWord?: boolean;
|
|
237
256
|
rows?: number;
|
|
238
257
|
screenReaderMode?: boolean;
|
|
@@ -246,7 +265,8 @@ export interface ITerminalOptions {
|
|
|
246
265
|
windowsPty?: IWindowsPty;
|
|
247
266
|
windowOptions?: IWindowOptions;
|
|
248
267
|
wordSeparator?: string;
|
|
249
|
-
|
|
268
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
269
|
+
scrollOnEraseInDisplay?: boolean;
|
|
250
270
|
|
|
251
271
|
[key: string]: any;
|
|
252
272
|
cancelEvents: boolean;
|
|
@@ -261,6 +281,10 @@ export interface ITheme {
|
|
|
261
281
|
selectionForeground?: string;
|
|
262
282
|
selectionBackground?: string;
|
|
263
283
|
selectionInactiveBackground?: string;
|
|
284
|
+
scrollbarSliderBackground?: string;
|
|
285
|
+
scrollbarSliderHoverBackground?: string;
|
|
286
|
+
scrollbarSliderActiveBackground?: string;
|
|
287
|
+
overviewRulerBorder?: string;
|
|
264
288
|
black?: string;
|
|
265
289
|
red?: string;
|
|
266
290
|
green?: string;
|
|
@@ -296,6 +320,29 @@ export interface IOscLinkService {
|
|
|
296
320
|
getLinkData(linkId: number): IOscLinkData | undefined;
|
|
297
321
|
}
|
|
298
322
|
|
|
323
|
+
/*
|
|
324
|
+
* Width and Grapheme_Cluster_Break properties of a character as a bit mask.
|
|
325
|
+
*
|
|
326
|
+
* bit 0: shouldJoin - should combine with preceding character.
|
|
327
|
+
* bit 1..2: wcwidth - see UnicodeCharWidth.
|
|
328
|
+
* bit 3..31: class of character (currently only 4 bits are used).
|
|
329
|
+
* This is used to determined grapheme clustering - i.e. which codepoints
|
|
330
|
+
* are to be combined into a single compound character.
|
|
331
|
+
*
|
|
332
|
+
* Use the UnicodeService static function createPropertyValue to create a
|
|
333
|
+
* UnicodeCharProperties; use extractShouldJoin, extractWidth, and
|
|
334
|
+
* extractCharKind to extract the components.
|
|
335
|
+
*/
|
|
336
|
+
export type UnicodeCharProperties = number;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Width in columns of a character.
|
|
340
|
+
* In a CJK context, "half-width" characters (such as Latin) are width 1,
|
|
341
|
+
* while "full-width" characters (such as Kanji) are 2 columns wide.
|
|
342
|
+
* Combining characters (such as accents) are width 0.
|
|
343
|
+
*/
|
|
344
|
+
export type UnicodeCharWidth = 0 | 1 | 2;
|
|
345
|
+
|
|
299
346
|
export const IUnicodeService = createDecorator<IUnicodeService>('UnicodeService');
|
|
300
347
|
export interface IUnicodeService {
|
|
301
348
|
serviceBrand: undefined;
|
|
@@ -306,26 +353,33 @@ export interface IUnicodeService {
|
|
|
306
353
|
/** Currently active version. */
|
|
307
354
|
activeVersion: string;
|
|
308
355
|
/** Event triggered, when activate version changed. */
|
|
309
|
-
readonly onChange:
|
|
356
|
+
readonly onChange: Event<string>;
|
|
310
357
|
|
|
311
358
|
/**
|
|
312
359
|
* Unicode version dependent
|
|
313
360
|
*/
|
|
314
|
-
wcwidth(codepoint: number):
|
|
361
|
+
wcwidth(codepoint: number): UnicodeCharWidth;
|
|
315
362
|
getStringCellWidth(s: string): number;
|
|
363
|
+
/**
|
|
364
|
+
* Return character width and type for grapheme clustering.
|
|
365
|
+
* If preceding != 0, it is the return code from the previous character;
|
|
366
|
+
* in that case the result specifies if the characters should be joined.
|
|
367
|
+
*/
|
|
368
|
+
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
|
|
316
369
|
}
|
|
317
370
|
|
|
318
371
|
export interface IUnicodeVersionProvider {
|
|
319
372
|
readonly version: string;
|
|
320
|
-
wcwidth(ucs: number):
|
|
373
|
+
wcwidth(ucs: number): UnicodeCharWidth;
|
|
374
|
+
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
|
|
321
375
|
}
|
|
322
376
|
|
|
323
377
|
export const IDecorationService = createDecorator<IDecorationService>('DecorationService');
|
|
324
378
|
export interface IDecorationService extends IDisposable {
|
|
325
379
|
serviceBrand: undefined;
|
|
326
380
|
readonly decorations: IterableIterator<IInternalDecoration>;
|
|
327
|
-
readonly onDecorationRegistered:
|
|
328
|
-
readonly onDecorationRemoved:
|
|
381
|
+
readonly onDecorationRegistered: Event<IInternalDecoration>;
|
|
382
|
+
readonly onDecorationRemoved: Event<IInternalDecoration>;
|
|
329
383
|
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
|
330
384
|
reset(): void;
|
|
331
385
|
/**
|
|
@@ -338,5 +392,5 @@ export interface IInternalDecoration extends IDecoration {
|
|
|
338
392
|
readonly options: IDecorationOptions;
|
|
339
393
|
readonly backgroundColorRGB: IColor | undefined;
|
|
340
394
|
readonly foregroundColorRGB: IColor | undefined;
|
|
341
|
-
readonly onRenderEmitter:
|
|
395
|
+
readonly onRenderEmitter: Emitter<HTMLElement>;
|
|
342
396
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
|
7
|
-
import { IUnicodeService, IUnicodeVersionProvider } from 'common/services/Services';
|
|
7
|
+
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
|
|
8
|
+
import { Emitter } from 'vs/base/common/event';
|
|
8
9
|
|
|
9
10
|
export class UnicodeService implements IUnicodeService {
|
|
10
11
|
public serviceBrand: any;
|
|
@@ -13,9 +14,22 @@ export class UnicodeService implements IUnicodeService {
|
|
|
13
14
|
private _active: string = '';
|
|
14
15
|
private _activeProvider: IUnicodeVersionProvider;
|
|
15
16
|
|
|
16
|
-
private readonly _onChange = new
|
|
17
|
+
private readonly _onChange = new Emitter<string>();
|
|
17
18
|
public readonly onChange = this._onChange.event;
|
|
18
19
|
|
|
20
|
+
public static extractShouldJoin(value: UnicodeCharProperties): boolean {
|
|
21
|
+
return (value & 1) !== 0;
|
|
22
|
+
}
|
|
23
|
+
public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {
|
|
24
|
+
return ((value >> 1) & 0x3) as UnicodeCharWidth;
|
|
25
|
+
}
|
|
26
|
+
public static extractCharKind(value: UnicodeCharProperties): number {
|
|
27
|
+
return value >> 3;
|
|
28
|
+
}
|
|
29
|
+
public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {
|
|
30
|
+
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
constructor() {
|
|
20
34
|
const defaultProvider = new UnicodeV6();
|
|
21
35
|
this.register(defaultProvider);
|
|
@@ -51,12 +65,13 @@ export class UnicodeService implements IUnicodeService {
|
|
|
51
65
|
/**
|
|
52
66
|
* Unicode version dependent interface.
|
|
53
67
|
*/
|
|
54
|
-
public wcwidth(num: number):
|
|
68
|
+
public wcwidth(num: number): UnicodeCharWidth {
|
|
55
69
|
return this._activeProvider.wcwidth(num);
|
|
56
70
|
}
|
|
57
71
|
|
|
58
72
|
public getStringCellWidth(s: string): number {
|
|
59
73
|
let result = 0;
|
|
74
|
+
let precedingInfo = 0;
|
|
60
75
|
const length = s.length;
|
|
61
76
|
for (let i = 0; i < length; ++i) {
|
|
62
77
|
let code = s.charCodeAt(i);
|
|
@@ -79,8 +94,18 @@ export class UnicodeService implements IUnicodeService {
|
|
|
79
94
|
result += this.wcwidth(second);
|
|
80
95
|
}
|
|
81
96
|
}
|
|
82
|
-
|
|
97
|
+
const currentInfo = this.charProperties(code, precedingInfo);
|
|
98
|
+
let chWidth = UnicodeService.extractWidth(currentInfo);
|
|
99
|
+
if (UnicodeService.extractShouldJoin(currentInfo)) {
|
|
100
|
+
chWidth -= UnicodeService.extractWidth(precedingInfo);
|
|
101
|
+
}
|
|
102
|
+
result += chWidth;
|
|
103
|
+
precedingInfo = currentInfo;
|
|
83
104
|
}
|
|
84
105
|
return result;
|
|
85
106
|
}
|
|
107
|
+
|
|
108
|
+
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
|
109
|
+
return this._activeProvider.charProperties(codepoint, preceding);
|
|
110
|
+
}
|
|
86
111
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
import { CodeWindow, mainWindow } from 'vs/base/browser/window';
|
|
7
|
+
import { Emitter } from 'vs/base/common/event';
|
|
8
|
+
|
|
9
|
+
class WindowManager {
|
|
10
|
+
|
|
11
|
+
static readonly INSTANCE = new WindowManager();
|
|
12
|
+
|
|
13
|
+
// --- Zoom Level
|
|
14
|
+
|
|
15
|
+
private readonly mapWindowIdToZoomLevel = new Map<number, number>();
|
|
16
|
+
|
|
17
|
+
private readonly _onDidChangeZoomLevel = new Emitter<number>();
|
|
18
|
+
readonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
|
|
19
|
+
|
|
20
|
+
getZoomLevel(targetWindow: Window): number {
|
|
21
|
+
return this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;
|
|
22
|
+
}
|
|
23
|
+
setZoomLevel(zoomLevel: number, targetWindow: Window): void {
|
|
24
|
+
if (this.getZoomLevel(targetWindow) === zoomLevel) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const targetWindowId = this.getWindowId(targetWindow);
|
|
29
|
+
this.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);
|
|
30
|
+
this._onDidChangeZoomLevel.fire(targetWindowId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// --- Zoom Factor
|
|
34
|
+
|
|
35
|
+
private readonly mapWindowIdToZoomFactor = new Map<number, number>();
|
|
36
|
+
|
|
37
|
+
getZoomFactor(targetWindow: Window): number {
|
|
38
|
+
return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;
|
|
39
|
+
}
|
|
40
|
+
setZoomFactor(zoomFactor: number, targetWindow: Window): void {
|
|
41
|
+
this.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- Fullscreen
|
|
45
|
+
|
|
46
|
+
private readonly _onDidChangeFullscreen = new Emitter<number>();
|
|
47
|
+
readonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;
|
|
48
|
+
|
|
49
|
+
private readonly mapWindowIdToFullScreen = new Map<number, boolean>();
|
|
50
|
+
|
|
51
|
+
setFullscreen(fullscreen: boolean, targetWindow: Window): void {
|
|
52
|
+
if (this.isFullscreen(targetWindow) === fullscreen) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const windowId = this.getWindowId(targetWindow);
|
|
57
|
+
this.mapWindowIdToFullScreen.set(windowId, fullscreen);
|
|
58
|
+
this._onDidChangeFullscreen.fire(windowId);
|
|
59
|
+
}
|
|
60
|
+
isFullscreen(targetWindow: Window): boolean {
|
|
61
|
+
return !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private getWindowId(targetWindow: Window): number {
|
|
65
|
+
return (targetWindow as CodeWindow).vscodeWindowId;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {
|
|
70
|
+
if (typeof query === 'string') {
|
|
71
|
+
query = targetWindow.matchMedia(query);
|
|
72
|
+
}
|
|
73
|
+
query.addEventListener('change', callback);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A zoom index, e.g. 1, 2, 3 */
|
|
77
|
+
export function setZoomLevel(zoomLevel: number, targetWindow: Window): void {
|
|
78
|
+
WindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);
|
|
79
|
+
}
|
|
80
|
+
export function getZoomLevel(targetWindow: Window): number {
|
|
81
|
+
return WindowManager.INSTANCE.getZoomLevel(targetWindow);
|
|
82
|
+
}
|
|
83
|
+
export const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;
|
|
84
|
+
|
|
85
|
+
/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
|
|
86
|
+
export function getZoomFactor(targetWindow: Window): number {
|
|
87
|
+
return WindowManager.INSTANCE.getZoomFactor(targetWindow);
|
|
88
|
+
}
|
|
89
|
+
export function setZoomFactor(zoomFactor: number, targetWindow: Window): void {
|
|
90
|
+
WindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function setFullscreen(fullscreen: boolean, targetWindow: Window): void {
|
|
94
|
+
WindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);
|
|
95
|
+
}
|
|
96
|
+
export function isFullscreen(targetWindow: Window): boolean {
|
|
97
|
+
return WindowManager.INSTANCE.isFullscreen(targetWindow);
|
|
98
|
+
}
|
|
99
|
+
export const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;
|
|
100
|
+
|
|
101
|
+
const userAgent = typeof navigator === 'object' ? navigator.userAgent : '';
|
|
102
|
+
|
|
103
|
+
export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
|
|
104
|
+
export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
|
|
105
|
+
export const isChrome = (userAgent.indexOf('Chrome') >= 0);
|
|
106
|
+
export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));
|
|
107
|
+
export const isWebkitWebView = (!isChrome && !isSafari && isWebKit);
|
|
108
|
+
export const isElectron = (userAgent.indexOf('Electron/') >= 0);
|
|
109
|
+
export const isAndroid = (userAgent.indexOf('Android') >= 0);
|
|
110
|
+
|
|
111
|
+
let standalone = false;
|
|
112
|
+
if (typeof mainWindow.matchMedia === 'function') {
|
|
113
|
+
const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');
|
|
114
|
+
const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');
|
|
115
|
+
standalone = standaloneMatchMedia.matches;
|
|
116
|
+
addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {
|
|
117
|
+
// entering fullscreen would change standaloneMatchMedia.matches to false
|
|
118
|
+
// if standalone is true (running as PWA) and entering fullscreen, skip this change
|
|
119
|
+
if (standalone && fullScreenMatchMedia.matches) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// otherwise update standalone (browser to PWA or PWA to browser)
|
|
123
|
+
standalone = matches;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function isStandalone(): boolean {
|
|
127
|
+
return standalone;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Visible means that the feature is enabled, not necessarily being rendered
|
|
131
|
+
// e.g. visible is true even in fullscreen mode where the controls are hidden
|
|
132
|
+
// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible
|
|
133
|
+
export function isWCOEnabled(): boolean {
|
|
134
|
+
return (navigator as any)?.windowControlsOverlay?.visible;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Returns the bounding rect of the titlebar area if it is supported and defined
|
|
138
|
+
// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect
|
|
139
|
+
export function getWCOBoundingRect(): DOMRect | undefined {
|
|
140
|
+
return (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();
|
|
141
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
import * as browser from 'vs/base/browser/browser';
|
|
7
|
+
import { mainWindow } from 'vs/base/browser/window';
|
|
8
|
+
import * as platform from 'vs/base/common/platform';
|
|
9
|
+
|
|
10
|
+
export const enum KeyboardSupport {
|
|
11
|
+
Always,
|
|
12
|
+
FullScreen,
|
|
13
|
+
None
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const safeNavigator = typeof navigator === 'object' ? navigator : {} as { [key: string]: any };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Browser feature we can support in current platform, browser and environment.
|
|
20
|
+
*/
|
|
21
|
+
export const BrowserFeatures = {
|
|
22
|
+
clipboard: {
|
|
23
|
+
writeText: (
|
|
24
|
+
platform.isNative
|
|
25
|
+
|| (document.queryCommandSupported && document.queryCommandSupported('copy'))
|
|
26
|
+
|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)
|
|
27
|
+
),
|
|
28
|
+
readText: (
|
|
29
|
+
platform.isNative
|
|
30
|
+
|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText)
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
keyboard: (() => {
|
|
34
|
+
if (platform.isNative || browser.isStandalone()) {
|
|
35
|
+
return KeyboardSupport.Always;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ((<any>safeNavigator).keyboard || browser.isSafari) {
|
|
39
|
+
return KeyboardSupport.FullScreen;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return KeyboardSupport.None;
|
|
43
|
+
})(),
|
|
44
|
+
|
|
45
|
+
// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
|
|
46
|
+
// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
|
|
47
|
+
touch: 'ontouchstart' in mainWindow || safeNavigator.maxTouchPoints > 0,
|
|
48
|
+
pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)
|
|
49
|
+
};
|