@xterm/xterm 5.6.0-beta.12 → 5.6.0-beta.120
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 +9 -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 +43 -33
- package/src/browser/AccessibilityManager.ts +54 -26
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +159 -145
- package/src/browser/Linkifier.ts +26 -14
- package/src/browser/LocalizableStrings.ts +15 -4
- package/src/browser/{Types.d.ts → Types.ts} +67 -15
- package/src/browser/Viewport.ts +143 -370
- package/src/browser/decorations/BufferDecorationRenderer.ts +14 -9
- package/src/browser/decorations/OverviewRulerRenderer.ts +40 -44
- package/src/browser/input/CompositionHelper.ts +2 -1
- package/src/browser/input/MoveToCell.ts +3 -1
- package/src/browser/public/Terminal.ts +25 -19
- package/src/browser/renderer/dom/DomRenderer.ts +19 -14
- package/src/browser/renderer/dom/DomRendererRowFactory.ts +35 -15
- package/src/browser/renderer/shared/Constants.ts +0 -8
- package/src/browser/renderer/shared/Types.ts +84 -0
- 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 +19 -58
- 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 +83 -56
- package/src/common/{Types.d.ts → Types.ts} +13 -17
- package/src/common/buffer/Buffer.ts +15 -7
- package/src/common/buffer/BufferReflow.ts +9 -6
- 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/Keyboard.ts +0 -24
- 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 +10 -7
- package/src/common/services/CoreMouseService.ts +53 -6
- package/src/common/services/CoreService.ts +8 -6
- package/src/common/services/DecorationService.ts +8 -9
- package/src/common/services/InstantiationService.ts +1 -1
- package/src/common/services/LogService.ts +2 -2
- package/src/common/services/OptionsService.ts +8 -6
- package/src/common/services/ServiceRegistry.ts +1 -1
- package/src/common/services/Services.ts +32 -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 +80 -14
- package/src/browser/Lifecycle.ts +0 -33
- package/src/browser/renderer/shared/CellColorResolver.ts +0 -236
- package/src/browser/renderer/shared/CharAtlasCache.ts +0 -96
- package/src/browser/renderer/shared/CharAtlasUtils.ts +0 -75
- package/src/browser/renderer/shared/CursorBlinkStateManager.ts +0 -146
- package/src/browser/renderer/shared/CustomGlyphs.ts +0 -687
- package/src/browser/renderer/shared/DevicePixelObserver.ts +0 -41
- package/src/browser/renderer/shared/TextureAtlas.ts +0 -1100
- package/src/browser/renderer/shared/Types.d.ts +0 -173
- 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
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
// Declare types that we probe for to implement util and/or polyfill functions
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
|
|
10
|
+
interface IdleDeadline {
|
|
11
|
+
readonly didTimeout: boolean;
|
|
12
|
+
timeRemaining(): number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function requestIdleCallback(callback: (args: IdleDeadline) => void, options?: { timeout: number }): number;
|
|
16
|
+
function cancelIdleCallback(handle: number): void;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { }
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
declare class LoaderEvent {
|
|
7
|
+
readonly type: number;
|
|
8
|
+
readonly timestamp: number;
|
|
9
|
+
readonly detail: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const define: {
|
|
13
|
+
(moduleName: string, dependencies: string[], callback: (...args: any[]) => any): any;
|
|
14
|
+
(moduleName: string, dependencies: string[], definition: any): any;
|
|
15
|
+
(moduleName: string, callback: (...args: any[]) => any): any;
|
|
16
|
+
(moduleName: string, definition: any): any;
|
|
17
|
+
(dependencies: string[], callback: (...args: any[]) => any): any;
|
|
18
|
+
(dependencies: string[], definition: any): any;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface NodeRequire {
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
|
|
24
|
+
*/
|
|
25
|
+
toUrl(path: string): string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated MUST not be used anymore
|
|
29
|
+
*
|
|
30
|
+
* With the move from AMD to ESM we cannot use this anymore. There will be NO MORE node require like this.
|
|
31
|
+
*/
|
|
32
|
+
__$__nodeRequire<T>(moduleName: string): T;
|
|
33
|
+
|
|
34
|
+
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
|
|
35
|
+
config(data: any): any;
|
|
36
|
+
onError: Function;
|
|
37
|
+
getStats?(): ReadonlyArray<LoaderEvent>;
|
|
38
|
+
hasDependencyCycle?(): boolean;
|
|
39
|
+
define(amdModuleId: string, dependencies: string[], callback: (...args: any[]) => any): any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare var require: NodeRequire;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
|
|
8
|
+
* and others. This API makes no assumption about what promise library is being used which
|
|
9
|
+
* enables reusing existing code without migrating to a specific promise implementation. Still,
|
|
10
|
+
* we recommend the use of native promises which are available in VS Code.
|
|
11
|
+
*/
|
|
12
|
+
interface Thenable<T> extends PromiseLike<T> { }
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
// AMD2ESM mirgation relevant
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* NLS Globals: these need to be defined in all contexts that make
|
|
10
|
+
* use of our `nls.localize` and `nls.localize2` functions. This includes:
|
|
11
|
+
* - Electron main process
|
|
12
|
+
* - Electron window (renderer) process
|
|
13
|
+
* - Utility Process
|
|
14
|
+
* - Node.js
|
|
15
|
+
* - Browser
|
|
16
|
+
* - Web worker
|
|
17
|
+
*
|
|
18
|
+
* That is because during build time we strip out all english strings from
|
|
19
|
+
* the resulting JS code and replace it with a <number> that is then looked
|
|
20
|
+
* up from the `_VSCODE_NLS_MESSAGES` array.
|
|
21
|
+
*/
|
|
22
|
+
declare global {
|
|
23
|
+
/**
|
|
24
|
+
* All NLS messages produced by `localize` and `localize2` calls
|
|
25
|
+
* under `src/vs` translated to the language as indicated by
|
|
26
|
+
* `_VSCODE_NLS_LANGUAGE`.
|
|
27
|
+
*/
|
|
28
|
+
var _VSCODE_NLS_MESSAGES: string[];
|
|
29
|
+
/**
|
|
30
|
+
* The actual language of the NLS messages (e.g. 'en', de' or 'pt-br').
|
|
31
|
+
*/
|
|
32
|
+
var _VSCODE_NLS_LANGUAGE: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// fake export to make global work
|
|
36
|
+
export { }
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
// AMD2ESM mirgation relevant
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Holds the file root for resources.
|
|
12
|
+
*/
|
|
13
|
+
var _VSCODE_FILE_ROOT: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CSS loader that's available during development time.
|
|
17
|
+
* DO NOT call directly, instead just import css modules, like `import 'some.css'`
|
|
18
|
+
*/
|
|
19
|
+
var _VSCODE_CSS_LOAD: (module: string) => void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated You MUST use `IProductService` whenever possible.
|
|
23
|
+
*/
|
|
24
|
+
var _VSCODE_PRODUCT_JSON: Record<string, any>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated You MUST use `IProductService` whenever possible.
|
|
27
|
+
*/
|
|
28
|
+
var _VSCODE_PACKAGE_JSON: Record<string, any>;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// fake export to make global work
|
|
33
|
+
export { }
|
package/typings/xterm.d.ts
CHANGED
|
@@ -109,11 +109,13 @@ declare module '@xterm/xterm' {
|
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* The modifier key hold to multiply scroll speed.
|
|
112
|
+
* @deprecated This option is no longer available and will always use alt.
|
|
113
|
+
* Setting this will be ignored.
|
|
112
114
|
*/
|
|
113
115
|
fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
|
-
* The scroll speed multiplier used for fast scrolling.
|
|
118
|
+
* The scroll speed multiplier used for fast scrolling when `Alt` is held.
|
|
117
119
|
*/
|
|
118
120
|
fastScrollSensitivity?: number;
|
|
119
121
|
|
|
@@ -211,6 +213,13 @@ declare module '@xterm/xterm' {
|
|
|
211
213
|
*/
|
|
212
214
|
minimumContrastRatio?: number;
|
|
213
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Whether to reflow the line containing the cursor when the terminal is
|
|
218
|
+
* resized. Defaults to false, because shells usually handle this
|
|
219
|
+
* themselves.
|
|
220
|
+
*/
|
|
221
|
+
reflowCursorLine?: boolean;
|
|
222
|
+
|
|
214
223
|
/**
|
|
215
224
|
* Whether to rescale glyphs horizontally that are a single cell wide but
|
|
216
225
|
* have glyphs that would overlap following cell(s). This typically happens
|
|
@@ -248,6 +257,13 @@ declare module '@xterm/xterm' {
|
|
|
248
257
|
*/
|
|
249
258
|
scrollback?: number;
|
|
250
259
|
|
|
260
|
+
/**
|
|
261
|
+
* If enabled the Erase in Display All (ED2) escape sequence will push
|
|
262
|
+
* erased text to scrollback, instead of clearing only the viewport portion.
|
|
263
|
+
* This emulates PuTTY's default clear screen behavior.
|
|
264
|
+
*/
|
|
265
|
+
scrollOnEraseInDisplay?: boolean;
|
|
266
|
+
|
|
251
267
|
/**
|
|
252
268
|
* Whether to scroll to the bottom whenever there is some user input. The
|
|
253
269
|
* default is true.
|
|
@@ -325,10 +341,10 @@ declare module '@xterm/xterm' {
|
|
|
325
341
|
windowOptions?: IWindowOptions;
|
|
326
342
|
|
|
327
343
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
344
|
+
* Controls the visibility and style of the overview ruler which visualizes
|
|
345
|
+
* decorations underneath the scroll bar.
|
|
330
346
|
*/
|
|
331
|
-
|
|
347
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
332
348
|
}
|
|
333
349
|
|
|
334
350
|
/**
|
|
@@ -368,6 +384,27 @@ declare module '@xterm/xterm' {
|
|
|
368
384
|
* be transparent)
|
|
369
385
|
*/
|
|
370
386
|
selectionInactiveBackground?: string;
|
|
387
|
+
/**
|
|
388
|
+
* The scrollbar slider background color. Defaults to
|
|
389
|
+
* {@link ITerminalOptions.foreground foreground} with 20% opacity.
|
|
390
|
+
*/
|
|
391
|
+
scrollbarSliderBackground?: string;
|
|
392
|
+
/**
|
|
393
|
+
* The scrollbar slider background color when hovered. Defaults to
|
|
394
|
+
* {@link ITerminalOptions.foreground foreground} with 40% opacity.
|
|
395
|
+
*/
|
|
396
|
+
scrollbarSliderHoverBackground?: string;
|
|
397
|
+
/**
|
|
398
|
+
* The scrollbar slider background color when clicked. Defaults to
|
|
399
|
+
* {@link ITerminalOptions.foreground foreground} with 50% opacity.
|
|
400
|
+
*/
|
|
401
|
+
scrollbarSliderActiveBackground?: string;
|
|
402
|
+
/**
|
|
403
|
+
* The border color of the overview ruler. This visually separates the
|
|
404
|
+
* terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
|
|
405
|
+
* set. When this is not set it defaults to black (`#000000`).
|
|
406
|
+
*/
|
|
407
|
+
overviewRulerBorder?: string;
|
|
371
408
|
/** ANSI black (eg. `\x1b[30m`) */
|
|
372
409
|
black?: string;
|
|
373
410
|
/** ANSI red (eg. `\x1b[31m`) */
|
|
@@ -588,16 +625,13 @@ declare module '@xterm/xterm' {
|
|
|
588
625
|
* What layer to render the decoration at when {@link backgroundColor} or
|
|
589
626
|
* {@link foregroundColor} are used. `'bottom'` will render under the
|
|
590
627
|
* selection, `'top`' will render above the selection\*.
|
|
591
|
-
*
|
|
592
|
-
* *\* The selection will render on top regardless of layer on the canvas
|
|
593
|
-
* renderer due to how it renders selection separately.*
|
|
594
628
|
*/
|
|
595
629
|
readonly layer?: 'bottom' | 'top';
|
|
596
630
|
|
|
597
631
|
/**
|
|
598
632
|
* When defined, renders the decoration in the overview ruler to the right
|
|
599
|
-
* of the terminal. {@link
|
|
600
|
-
*
|
|
633
|
+
* of the terminal. {@link IOverviewRulerOptions.width} must be set in order
|
|
634
|
+
* to see the overview ruler.
|
|
601
635
|
* @param color The color of the decoration.
|
|
602
636
|
* @param position The position of the decoration.
|
|
603
637
|
*/
|
|
@@ -620,6 +654,28 @@ declare module '@xterm/xterm' {
|
|
|
620
654
|
tooMuchOutput: string;
|
|
621
655
|
}
|
|
622
656
|
|
|
657
|
+
export interface IOverviewRulerOptions {
|
|
658
|
+
/**
|
|
659
|
+
* When defined, renders decorations in the overview ruler to the right of
|
|
660
|
+
* the terminal. This must be set in order to see the overview ruler.
|
|
661
|
+
* @param color The color of the decoration.
|
|
662
|
+
* @param position The position of the decoration.
|
|
663
|
+
*/
|
|
664
|
+
width?: number;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Whether to show the top border of the overview ruler, which uses the
|
|
668
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
669
|
+
*/
|
|
670
|
+
showTopBorder?: boolean;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Whether to show the bottom border of the overview ruler, which uses the
|
|
674
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
675
|
+
*/
|
|
676
|
+
showBottomBorder?: boolean;
|
|
677
|
+
}
|
|
678
|
+
|
|
623
679
|
/**
|
|
624
680
|
* Enable various window manipulation and report features
|
|
625
681
|
* (`CSI Ps ; Ps ; Ps t`).
|
|
@@ -1092,7 +1148,7 @@ declare module '@xterm/xterm' {
|
|
|
1092
1148
|
* render together, since they aren't drawn as optimally as individual
|
|
1093
1149
|
* characters.
|
|
1094
1150
|
*
|
|
1095
|
-
* NOTE: character joiners are only used by the
|
|
1151
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1096
1152
|
*
|
|
1097
1153
|
* @param handler The function that determines character joins. It is called
|
|
1098
1154
|
* with a string of text that is eligible for joining and returns an array
|
|
@@ -1104,7 +1160,7 @@ declare module '@xterm/xterm' {
|
|
|
1104
1160
|
|
|
1105
1161
|
/**
|
|
1106
1162
|
* (EXPERIMENTAL) Deregisters the character joiner if one was registered.
|
|
1107
|
-
* NOTE: character joiners are only used by the
|
|
1163
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1108
1164
|
* @param joinerId The character joiner's ID (returned after register)
|
|
1109
1165
|
*/
|
|
1110
1166
|
deregisterCharacterJoiner(joinerId: number): void;
|
|
@@ -1209,21 +1265,31 @@ declare module '@xterm/xterm' {
|
|
|
1209
1265
|
|
|
1210
1266
|
/**
|
|
1211
1267
|
* Write data to the terminal.
|
|
1268
|
+
*
|
|
1269
|
+
* Note that the change will not be reflected in the {@link buffer}
|
|
1270
|
+
* immediately as the data is processed asynchronously. Provide a
|
|
1271
|
+
* {@link callback} to know when the data was processed.
|
|
1212
1272
|
* @param data The data to write to the terminal. This can either be raw
|
|
1213
1273
|
* bytes given as Uint8Array from the pty or a string. Raw bytes will always
|
|
1214
1274
|
* be treated as UTF-8 encoded, string data as UTF-16.
|
|
1215
1275
|
* @param callback Optional callback that fires when the data was processed
|
|
1216
|
-
* by the parser.
|
|
1276
|
+
* by the parser. This callback must be provided and awaited in order for
|
|
1277
|
+
* {@link buffer} to reflect the change in the write.
|
|
1217
1278
|
*/
|
|
1218
1279
|
write(data: string | Uint8Array, callback?: () => void): void;
|
|
1219
1280
|
|
|
1220
1281
|
/**
|
|
1221
1282
|
* Writes data to the terminal, followed by a break line character (\n).
|
|
1283
|
+
*
|
|
1284
|
+
* Note that the change will not be reflected in the {@link buffer}
|
|
1285
|
+
* immediately as the data is processed asynchronously. Provide a
|
|
1286
|
+
* {@link callback} to know when the data was processed.
|
|
1222
1287
|
* @param data The data to write to the terminal. This can either be raw
|
|
1223
1288
|
* bytes given as Uint8Array from the pty or a string. Raw bytes will always
|
|
1224
1289
|
* be treated as UTF-8 encoded, string data as UTF-16.
|
|
1225
1290
|
* @param callback Optional callback that fires when the data was processed
|
|
1226
|
-
* by the parser.
|
|
1291
|
+
* by the parser. This callback must be provided and awaited in order for
|
|
1292
|
+
* {@link buffer} to reflect the change in the write.
|
|
1227
1293
|
*/
|
|
1228
1294
|
writeln(data: string | Uint8Array, callback?: () => void): void;
|
|
1229
1295
|
|
|
@@ -1243,7 +1309,7 @@ declare module '@xterm/xterm' {
|
|
|
1243
1309
|
refresh(start: number, end: number): void;
|
|
1244
1310
|
|
|
1245
1311
|
/**
|
|
1246
|
-
* Clears the texture atlas of the
|
|
1312
|
+
* Clears the texture atlas of the webgl renderer if it's active. Doing
|
|
1247
1313
|
* this will force a redraw of all glyphs which can workaround issues
|
|
1248
1314
|
* causing the texture to become corrupt, for example Chromium/Nvidia has an
|
|
1249
1315
|
* issue where the texture gets messed up when resuming the OS from sleep.
|
package/src/browser/Lifecycle.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IDisposable } from 'common/Types';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Adds a disposable listener to a node in the DOM, returning the disposable.
|
|
10
|
-
* @param node The node to add a listener to.
|
|
11
|
-
* @param type The event type.
|
|
12
|
-
* @param handler The handler for the listener.
|
|
13
|
-
* @param options The boolean or options object to pass on to the event
|
|
14
|
-
* listener.
|
|
15
|
-
*/
|
|
16
|
-
export function addDisposableDomListener(
|
|
17
|
-
node: Element | Window | Document,
|
|
18
|
-
type: string,
|
|
19
|
-
handler: (e: any) => void,
|
|
20
|
-
options?: boolean | AddEventListenerOptions
|
|
21
|
-
): IDisposable {
|
|
22
|
-
node.addEventListener(type, handler, options);
|
|
23
|
-
let disposed = false;
|
|
24
|
-
return {
|
|
25
|
-
dispose: () => {
|
|
26
|
-
if (disposed) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
disposed = true;
|
|
30
|
-
node.removeEventListener(type, handler, options);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
|
|
2
|
-
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
|
3
|
-
import { ReadonlyColorSet } from 'browser/Types';
|
|
4
|
-
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
|
|
5
|
-
import { IDecorationService, IOptionsService } from 'common/services/Services';
|
|
6
|
-
import { ICellData } from 'common/Types';
|
|
7
|
-
import { Terminal } from '@xterm/xterm';
|
|
8
|
-
import { rgba } from 'common/Color';
|
|
9
|
-
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
|
|
10
|
-
|
|
11
|
-
// Work variables to avoid garbage collection
|
|
12
|
-
let $fg = 0;
|
|
13
|
-
let $bg = 0;
|
|
14
|
-
let $hasFg = false;
|
|
15
|
-
let $hasBg = false;
|
|
16
|
-
let $isSelected = false;
|
|
17
|
-
let $colors: ReadonlyColorSet | undefined;
|
|
18
|
-
let $variantOffset = 0;
|
|
19
|
-
|
|
20
|
-
export class CellColorResolver {
|
|
21
|
-
/**
|
|
22
|
-
* The shared result of the {@link resolve} call. This is only safe to use immediately after as
|
|
23
|
-
* any other calls will share object.
|
|
24
|
-
*/
|
|
25
|
-
public readonly result: { fg: number, bg: number, ext: number } = {
|
|
26
|
-
fg: 0,
|
|
27
|
-
bg: 0,
|
|
28
|
-
ext: 0
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
private readonly _terminal: Terminal,
|
|
33
|
-
private readonly _optionService: IOptionsService,
|
|
34
|
-
private readonly _selectionRenderModel: ISelectionRenderModel,
|
|
35
|
-
private readonly _decorationService: IDecorationService,
|
|
36
|
-
private readonly _coreBrowserService: ICoreBrowserService,
|
|
37
|
-
private readonly _themeService: IThemeService
|
|
38
|
-
) {
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Resolves colors for the cell, putting the result into the shared {@link result}. This resolves
|
|
43
|
-
* overrides, inverse and selection for the cell which can then be used to feed into the renderer.
|
|
44
|
-
*/
|
|
45
|
-
public resolve(cell: ICellData, x: number, y: number, deviceCellWidth: number): void {
|
|
46
|
-
this.result.bg = cell.bg;
|
|
47
|
-
this.result.fg = cell.fg;
|
|
48
|
-
this.result.ext = cell.bg & BgFlags.HAS_EXTENDED ? cell.extended.ext : 0;
|
|
49
|
-
// Get any foreground/background overrides, this happens on the model to avoid spreading
|
|
50
|
-
// override logic throughout the different sub-renderers
|
|
51
|
-
|
|
52
|
-
// Reset overrides work variables
|
|
53
|
-
$bg = 0;
|
|
54
|
-
$fg = 0;
|
|
55
|
-
$hasBg = false;
|
|
56
|
-
$hasFg = false;
|
|
57
|
-
$isSelected = false;
|
|
58
|
-
$colors = this._themeService.colors;
|
|
59
|
-
$variantOffset = 0;
|
|
60
|
-
|
|
61
|
-
const code = cell.getCode();
|
|
62
|
-
if (code !== NULL_CELL_CODE && cell.extended.underlineStyle === UnderlineStyle.DOTTED) {
|
|
63
|
-
const lineWidth = Math.max(1, Math.floor(this._optionService.rawOptions.fontSize * this._coreBrowserService.dpr / 15));
|
|
64
|
-
$variantOffset = x * deviceCellWidth % (Math.round(lineWidth) * 2);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Apply decorations on the bottom layer
|
|
68
|
-
this._decorationService.forEachDecorationAtCell(x, y, 'bottom', d => {
|
|
69
|
-
if (d.backgroundColorRGB) {
|
|
70
|
-
$bg = d.backgroundColorRGB.rgba >> 8 & Attributes.RGB_MASK;
|
|
71
|
-
$hasBg = true;
|
|
72
|
-
}
|
|
73
|
-
if (d.foregroundColorRGB) {
|
|
74
|
-
$fg = d.foregroundColorRGB.rgba >> 8 & Attributes.RGB_MASK;
|
|
75
|
-
$hasFg = true;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Apply the selection color if needed
|
|
80
|
-
$isSelected = this._selectionRenderModel.isCellSelected(this._terminal, x, y);
|
|
81
|
-
if ($isSelected) {
|
|
82
|
-
// If the cell has a bg color, retain the color by blending it with the selection color
|
|
83
|
-
if (
|
|
84
|
-
(this.result.fg & FgFlags.INVERSE) ||
|
|
85
|
-
(this.result.bg & Attributes.CM_MASK) !== Attributes.CM_DEFAULT
|
|
86
|
-
) {
|
|
87
|
-
// Resolve the standard bg color
|
|
88
|
-
if (this.result.fg & FgFlags.INVERSE) {
|
|
89
|
-
switch (this.result.fg & Attributes.CM_MASK) {
|
|
90
|
-
case Attributes.CM_P16:
|
|
91
|
-
case Attributes.CM_P256:
|
|
92
|
-
$bg = this._themeService.colors.ansi[this.result.fg & Attributes.PCOLOR_MASK].rgba;
|
|
93
|
-
break;
|
|
94
|
-
case Attributes.CM_RGB:
|
|
95
|
-
$bg = ((this.result.fg & Attributes.RGB_MASK) << 8) | 0xFF;
|
|
96
|
-
break;
|
|
97
|
-
case Attributes.CM_DEFAULT:
|
|
98
|
-
default:
|
|
99
|
-
$bg = this._themeService.colors.foreground.rgba;
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
switch (this.result.bg & Attributes.CM_MASK) {
|
|
103
|
-
case Attributes.CM_P16:
|
|
104
|
-
case Attributes.CM_P256:
|
|
105
|
-
$bg = this._themeService.colors.ansi[this.result.bg & Attributes.PCOLOR_MASK].rgba;
|
|
106
|
-
break;
|
|
107
|
-
case Attributes.CM_RGB:
|
|
108
|
-
$bg = ((this.result.bg & Attributes.RGB_MASK) << 8) | 0xFF;
|
|
109
|
-
break;
|
|
110
|
-
// No need to consider default bg color here as it's not possible
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Blend with selection bg color
|
|
114
|
-
$bg = rgba.blend(
|
|
115
|
-
$bg,
|
|
116
|
-
((this._coreBrowserService.isFocused ? $colors.selectionBackgroundOpaque : $colors.selectionInactiveBackgroundOpaque).rgba & 0xFFFFFF00) | 0x80
|
|
117
|
-
) >> 8 & Attributes.RGB_MASK;
|
|
118
|
-
} else {
|
|
119
|
-
$bg = (this._coreBrowserService.isFocused ? $colors.selectionBackgroundOpaque : $colors.selectionInactiveBackgroundOpaque).rgba >> 8 & Attributes.RGB_MASK;
|
|
120
|
-
}
|
|
121
|
-
$hasBg = true;
|
|
122
|
-
|
|
123
|
-
// Apply explicit selection foreground if present
|
|
124
|
-
if ($colors.selectionForeground) {
|
|
125
|
-
$fg = $colors.selectionForeground.rgba >> 8 & Attributes.RGB_MASK;
|
|
126
|
-
$hasFg = true;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Overwrite fg as bg if it's a special decorative glyph (eg. powerline)
|
|
130
|
-
if (treatGlyphAsBackgroundColor(cell.getCode())) {
|
|
131
|
-
// Inverse default background should be treated as transparent
|
|
132
|
-
if (
|
|
133
|
-
(this.result.fg & FgFlags.INVERSE) &&
|
|
134
|
-
(this.result.bg & Attributes.CM_MASK) === Attributes.CM_DEFAULT
|
|
135
|
-
) {
|
|
136
|
-
$fg = (this._coreBrowserService.isFocused ? $colors.selectionBackgroundOpaque : $colors.selectionInactiveBackgroundOpaque).rgba >> 8 & Attributes.RGB_MASK;
|
|
137
|
-
} else {
|
|
138
|
-
|
|
139
|
-
if (this.result.fg & FgFlags.INVERSE) {
|
|
140
|
-
switch (this.result.bg & Attributes.CM_MASK) {
|
|
141
|
-
case Attributes.CM_P16:
|
|
142
|
-
case Attributes.CM_P256:
|
|
143
|
-
$fg = this._themeService.colors.ansi[this.result.bg & Attributes.PCOLOR_MASK].rgba;
|
|
144
|
-
break;
|
|
145
|
-
case Attributes.CM_RGB:
|
|
146
|
-
$fg = ((this.result.bg & Attributes.RGB_MASK) << 8) | 0xFF;
|
|
147
|
-
break;
|
|
148
|
-
// No need to consider default bg color here as it's not possible
|
|
149
|
-
}
|
|
150
|
-
} else {
|
|
151
|
-
switch (this.result.fg & Attributes.CM_MASK) {
|
|
152
|
-
case Attributes.CM_P16:
|
|
153
|
-
case Attributes.CM_P256:
|
|
154
|
-
$fg = this._themeService.colors.ansi[this.result.fg & Attributes.PCOLOR_MASK].rgba;
|
|
155
|
-
break;
|
|
156
|
-
case Attributes.CM_RGB:
|
|
157
|
-
$fg = ((this.result.fg & Attributes.RGB_MASK) << 8) | 0xFF;
|
|
158
|
-
break;
|
|
159
|
-
case Attributes.CM_DEFAULT:
|
|
160
|
-
default:
|
|
161
|
-
$fg = this._themeService.colors.foreground.rgba;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
$fg = rgba.blend(
|
|
166
|
-
$fg,
|
|
167
|
-
((this._coreBrowserService.isFocused ? $colors.selectionBackgroundOpaque : $colors.selectionInactiveBackgroundOpaque).rgba & 0xFFFFFF00) | 0x80
|
|
168
|
-
) >> 8 & Attributes.RGB_MASK;
|
|
169
|
-
}
|
|
170
|
-
$hasFg = true;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Apply decorations on the top layer
|
|
175
|
-
this._decorationService.forEachDecorationAtCell(x, y, 'top', d => {
|
|
176
|
-
if (d.backgroundColorRGB) {
|
|
177
|
-
$bg = d.backgroundColorRGB.rgba >> 8 & Attributes.RGB_MASK;
|
|
178
|
-
$hasBg = true;
|
|
179
|
-
}
|
|
180
|
-
if (d.foregroundColorRGB) {
|
|
181
|
-
$fg = d.foregroundColorRGB.rgba >> 8 & Attributes.RGB_MASK;
|
|
182
|
-
$hasFg = true;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// Convert any overrides from rgba to the fg/bg packed format. This resolves the inverse flag
|
|
187
|
-
// ahead of time in order to use the correct cache key
|
|
188
|
-
if ($hasBg) {
|
|
189
|
-
if ($isSelected) {
|
|
190
|
-
// Non-RGB attributes from model + force non-dim + override + force RGB color mode
|
|
191
|
-
$bg = (cell.bg & ~Attributes.RGB_MASK & ~BgFlags.DIM) | $bg | Attributes.CM_RGB;
|
|
192
|
-
} else {
|
|
193
|
-
// Non-RGB attributes from model + override + force RGB color mode
|
|
194
|
-
$bg = (cell.bg & ~Attributes.RGB_MASK) | $bg | Attributes.CM_RGB;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
if ($hasFg) {
|
|
198
|
-
// Non-RGB attributes from model + force disable inverse + override + force RGB color mode
|
|
199
|
-
$fg = (cell.fg & ~Attributes.RGB_MASK & ~FgFlags.INVERSE) | $fg | Attributes.CM_RGB;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Handle case where inverse was specified by only one of bg override or fg override was set,
|
|
203
|
-
// resolving the other inverse color and setting the inverse flag if needed.
|
|
204
|
-
if (this.result.fg & FgFlags.INVERSE) {
|
|
205
|
-
if ($hasBg && !$hasFg) {
|
|
206
|
-
// Resolve bg color type (default color has a different meaning in fg vs bg)
|
|
207
|
-
if ((this.result.bg & Attributes.CM_MASK) === Attributes.CM_DEFAULT) {
|
|
208
|
-
$fg = (this.result.fg & ~(Attributes.RGB_MASK | FgFlags.INVERSE | Attributes.CM_MASK)) | (($colors.background.rgba >> 8 & Attributes.RGB_MASK) & Attributes.RGB_MASK) | Attributes.CM_RGB;
|
|
209
|
-
} else {
|
|
210
|
-
$fg = (this.result.fg & ~(Attributes.RGB_MASK | FgFlags.INVERSE | Attributes.CM_MASK)) | this.result.bg & (Attributes.RGB_MASK | Attributes.CM_MASK);
|
|
211
|
-
}
|
|
212
|
-
$hasFg = true;
|
|
213
|
-
}
|
|
214
|
-
if (!$hasBg && $hasFg) {
|
|
215
|
-
// Resolve bg color type (default color has a different meaning in fg vs bg)
|
|
216
|
-
if ((this.result.fg & Attributes.CM_MASK) === Attributes.CM_DEFAULT) {
|
|
217
|
-
$bg = (this.result.bg & ~(Attributes.RGB_MASK | Attributes.CM_MASK)) | (($colors.foreground.rgba >> 8 & Attributes.RGB_MASK) & Attributes.RGB_MASK) | Attributes.CM_RGB;
|
|
218
|
-
} else {
|
|
219
|
-
$bg = (this.result.bg & ~(Attributes.RGB_MASK | Attributes.CM_MASK)) | this.result.fg & (Attributes.RGB_MASK | Attributes.CM_MASK);
|
|
220
|
-
}
|
|
221
|
-
$hasBg = true;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Release object
|
|
226
|
-
$colors = undefined;
|
|
227
|
-
|
|
228
|
-
// Use the override if it exists
|
|
229
|
-
this.result.bg = $hasBg ? $bg : this.result.bg;
|
|
230
|
-
this.result.fg = $hasFg ? $fg : this.result.fg;
|
|
231
|
-
|
|
232
|
-
// Reset overrides variantOffset
|
|
233
|
-
this.result.ext &= ~ExtFlags.VARIANT_OFFSET;
|
|
234
|
-
this.result.ext |= ($variantOffset << 29) & ExtFlags.VARIANT_OFFSET;
|
|
235
|
-
}
|
|
236
|
-
}
|