@xterm/xterm 5.6.0-beta.9 → 5.6.0-beta.90
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 +53 -25
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +139 -148
- 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/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/CharAtlasCache.ts +3 -2
- package/src/browser/renderer/shared/CharAtlasUtils.ts +6 -1
- 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 +45 -12
- package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +7 -6
- 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 +63 -51
- 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/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 +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 +7 -6
- package/src/common/services/ServiceRegistry.ts +1 -1
- package/src/common/services/Services.ts +26 -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 +66 -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
|
@@ -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
|
@@ -47,11 +47,13 @@ declare module '@xterm/xterm' {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* When enabled the cursor will be set to the beginning of the next line
|
|
50
|
-
* with every new line. This is equivalent to sending
|
|
51
|
-
* Normally the
|
|
52
|
-
* translation of
|
|
50
|
+
* with every new line. This is equivalent to sending `\r\n` for each `\n`.
|
|
51
|
+
* Normally the settings of the underlying PTY (`termios`) deal with the
|
|
52
|
+
* translation of `\n` to `\r\n` and this setting should not be used. If you
|
|
53
53
|
* deal with data from a non-PTY related source, this settings might be
|
|
54
54
|
* useful.
|
|
55
|
+
*
|
|
56
|
+
* @see https://pubs.opengroup.org/onlinepubs/007904975/basedefs/termios.h.html
|
|
55
57
|
*/
|
|
56
58
|
convertEol?: boolean;
|
|
57
59
|
|
|
@@ -107,11 +109,13 @@ declare module '@xterm/xterm' {
|
|
|
107
109
|
|
|
108
110
|
/**
|
|
109
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.
|
|
110
114
|
*/
|
|
111
115
|
fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
|
-
* The scroll speed multiplier used for fast scrolling.
|
|
118
|
+
* The scroll speed multiplier used for fast scrolling when `Alt` is held.
|
|
115
119
|
*/
|
|
116
120
|
fastScrollSensitivity?: number;
|
|
117
121
|
|
|
@@ -209,6 +213,13 @@ declare module '@xterm/xterm' {
|
|
|
209
213
|
*/
|
|
210
214
|
minimumContrastRatio?: number;
|
|
211
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
|
+
|
|
212
223
|
/**
|
|
213
224
|
* Whether to rescale glyphs horizontally that are a single cell wide but
|
|
214
225
|
* have glyphs that would overlap following cell(s). This typically happens
|
|
@@ -323,10 +334,10 @@ declare module '@xterm/xterm' {
|
|
|
323
334
|
windowOptions?: IWindowOptions;
|
|
324
335
|
|
|
325
336
|
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
337
|
+
* Controls the visibility and style of the overview ruler which visualizes
|
|
338
|
+
* decorations underneath the scroll bar.
|
|
328
339
|
*/
|
|
329
|
-
|
|
340
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
330
341
|
}
|
|
331
342
|
|
|
332
343
|
/**
|
|
@@ -366,6 +377,27 @@ declare module '@xterm/xterm' {
|
|
|
366
377
|
* be transparent)
|
|
367
378
|
*/
|
|
368
379
|
selectionInactiveBackground?: string;
|
|
380
|
+
/**
|
|
381
|
+
* The scrollbar slider background color. Defaults to
|
|
382
|
+
* {@link ITerminalOptions.foreground foreground} with 20% opacity.
|
|
383
|
+
*/
|
|
384
|
+
scrollbarSliderBackground?: string;
|
|
385
|
+
/**
|
|
386
|
+
* The scrollbar slider background color when hovered. Defaults to
|
|
387
|
+
* {@link ITerminalOptions.foreground foreground} with 40% opacity.
|
|
388
|
+
*/
|
|
389
|
+
scrollbarSliderHoverBackground?: string;
|
|
390
|
+
/**
|
|
391
|
+
* The scrollbar slider background color when clicked. Defaults to
|
|
392
|
+
* {@link ITerminalOptions.foreground foreground} with 50% opacity.
|
|
393
|
+
*/
|
|
394
|
+
scrollbarSliderActiveBackground?: string;
|
|
395
|
+
/**
|
|
396
|
+
* The border color of the overview ruler. This visually separates the
|
|
397
|
+
* terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
|
|
398
|
+
* set. When this is not set it defaults to black (`#000000`).
|
|
399
|
+
*/
|
|
400
|
+
overviewRulerBorder?: string;
|
|
369
401
|
/** ANSI black (eg. `\x1b[30m`) */
|
|
370
402
|
black?: string;
|
|
371
403
|
/** ANSI red (eg. `\x1b[31m`) */
|
|
@@ -586,16 +618,13 @@ declare module '@xterm/xterm' {
|
|
|
586
618
|
* What layer to render the decoration at when {@link backgroundColor} or
|
|
587
619
|
* {@link foregroundColor} are used. `'bottom'` will render under the
|
|
588
620
|
* selection, `'top`' will render above the selection\*.
|
|
589
|
-
*
|
|
590
|
-
* *\* The selection will render on top regardless of layer on the canvas
|
|
591
|
-
* renderer due to how it renders selection separately.*
|
|
592
621
|
*/
|
|
593
622
|
readonly layer?: 'bottom' | 'top';
|
|
594
623
|
|
|
595
624
|
/**
|
|
596
625
|
* When defined, renders the decoration in the overview ruler to the right
|
|
597
|
-
* of the terminal. {@link
|
|
598
|
-
*
|
|
626
|
+
* of the terminal. {@link IOverviewRulerOptions.width} must be set in order
|
|
627
|
+
* to see the overview ruler.
|
|
599
628
|
* @param color The color of the decoration.
|
|
600
629
|
* @param position The position of the decoration.
|
|
601
630
|
*/
|
|
@@ -618,6 +647,28 @@ declare module '@xterm/xterm' {
|
|
|
618
647
|
tooMuchOutput: string;
|
|
619
648
|
}
|
|
620
649
|
|
|
650
|
+
export interface IOverviewRulerOptions {
|
|
651
|
+
/**
|
|
652
|
+
* When defined, renders decorations in the overview ruler to the right of
|
|
653
|
+
* the terminal. This must be set in order to see the overview ruler.
|
|
654
|
+
* @param color The color of the decoration.
|
|
655
|
+
* @param position The position of the decoration.
|
|
656
|
+
*/
|
|
657
|
+
width?: number;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Whether to show the top border of the overview ruler, which uses the
|
|
661
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
662
|
+
*/
|
|
663
|
+
showTopBorder?: boolean;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Whether to show the bottom border of the overview ruler, which uses the
|
|
667
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
668
|
+
*/
|
|
669
|
+
showBottomBorder?: boolean;
|
|
670
|
+
}
|
|
671
|
+
|
|
621
672
|
/**
|
|
622
673
|
* Enable various window manipulation and report features
|
|
623
674
|
* (`CSI Ps ; Ps ; Ps t`).
|
|
@@ -1090,7 +1141,7 @@ declare module '@xterm/xterm' {
|
|
|
1090
1141
|
* render together, since they aren't drawn as optimally as individual
|
|
1091
1142
|
* characters.
|
|
1092
1143
|
*
|
|
1093
|
-
* NOTE: character joiners are only used by the
|
|
1144
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1094
1145
|
*
|
|
1095
1146
|
* @param handler The function that determines character joins. It is called
|
|
1096
1147
|
* with a string of text that is eligible for joining and returns an array
|
|
@@ -1102,7 +1153,7 @@ declare module '@xterm/xterm' {
|
|
|
1102
1153
|
|
|
1103
1154
|
/**
|
|
1104
1155
|
* (EXPERIMENTAL) Deregisters the character joiner if one was registered.
|
|
1105
|
-
* NOTE: character joiners are only used by the
|
|
1156
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1106
1157
|
* @param joinerId The character joiner's ID (returned after register)
|
|
1107
1158
|
*/
|
|
1108
1159
|
deregisterCharacterJoiner(joinerId: number): void;
|
|
@@ -1241,7 +1292,7 @@ declare module '@xterm/xterm' {
|
|
|
1241
1292
|
refresh(start: number, end: number): void;
|
|
1242
1293
|
|
|
1243
1294
|
/**
|
|
1244
|
-
* Clears the texture atlas of the
|
|
1295
|
+
* Clears the texture atlas of the webgl renderer if it's active. Doing
|
|
1245
1296
|
* this will force a redraw of all glyphs which can workaround issues
|
|
1246
1297
|
* causing the texture to become corrupt, for example Chromium/Nvidia has an
|
|
1247
1298
|
* 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,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IDisposable } from 'common/Types';
|
|
7
|
-
|
|
8
|
-
interface IListener<T, U = void> {
|
|
9
|
-
(arg1: T, arg2: U): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IEvent<T, U = void> {
|
|
13
|
-
(listener: (arg1: T, arg2: U) => any): IDisposable;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IEventEmitter<T, U = void> {
|
|
17
|
-
event: IEvent<T, U>;
|
|
18
|
-
fire(arg1: T, arg2: U): void;
|
|
19
|
-
dispose(): void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class EventEmitter<T, U = void> implements IEventEmitter<T, U> {
|
|
23
|
-
private _listeners: IListener<T, U>[] = [];
|
|
24
|
-
private _event?: IEvent<T, U>;
|
|
25
|
-
private _disposed: boolean = false;
|
|
26
|
-
|
|
27
|
-
public get event(): IEvent<T, U> {
|
|
28
|
-
if (!this._event) {
|
|
29
|
-
this._event = (listener: (arg1: T, arg2: U) => any) => {
|
|
30
|
-
this._listeners.push(listener);
|
|
31
|
-
const disposable = {
|
|
32
|
-
dispose: () => {
|
|
33
|
-
if (!this._disposed) {
|
|
34
|
-
for (let i = 0; i < this._listeners.length; i++) {
|
|
35
|
-
if (this._listeners[i] === listener) {
|
|
36
|
-
this._listeners.splice(i, 1);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return disposable;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return this._event;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public fire(arg1: T, arg2: U): void {
|
|
50
|
-
const queue: IListener<T, U>[] = [];
|
|
51
|
-
for (let i = 0; i < this._listeners.length; i++) {
|
|
52
|
-
queue.push(this._listeners[i]);
|
|
53
|
-
}
|
|
54
|
-
for (let i = 0; i < queue.length; i++) {
|
|
55
|
-
queue[i].call(undefined, arg1, arg2);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public dispose(): void {
|
|
60
|
-
this.clearListeners();
|
|
61
|
-
this._disposed = true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public clearListeners(): void {
|
|
65
|
-
if (this._listeners) {
|
|
66
|
-
this._listeners.length = 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function forwardEvent<T>(from: IEvent<T>, to: IEventEmitter<T>): IDisposable {
|
|
72
|
-
return from(e => to.fire(e));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function runAndSubscribe<T>(event: IEvent<T>, handler: (e: T | undefined) => any): IDisposable {
|
|
76
|
-
handler(undefined);
|
|
77
|
-
return event(e => handler(e));
|
|
78
|
-
}
|
package/src/common/Lifecycle.ts
DELETED
|
@@ -1,108 +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
|
-
* A base class that can be extended to provide convenience methods for managing the lifecycle of an
|
|
10
|
-
* object and its components.
|
|
11
|
-
*/
|
|
12
|
-
export abstract class Disposable implements IDisposable {
|
|
13
|
-
protected _disposables: IDisposable[] = [];
|
|
14
|
-
protected _isDisposed: boolean = false;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Disposes the object, triggering the `dispose` method on all registered IDisposables.
|
|
18
|
-
*/
|
|
19
|
-
public dispose(): void {
|
|
20
|
-
this._isDisposed = true;
|
|
21
|
-
for (const d of this._disposables) {
|
|
22
|
-
d.dispose();
|
|
23
|
-
}
|
|
24
|
-
this._disposables.length = 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Registers a disposable object.
|
|
29
|
-
* @param d The disposable to register.
|
|
30
|
-
* @returns The disposable.
|
|
31
|
-
*/
|
|
32
|
-
public register<T extends IDisposable>(d: T): T {
|
|
33
|
-
this._disposables.push(d);
|
|
34
|
-
return d;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Unregisters a disposable object if it has been registered, if not do
|
|
39
|
-
* nothing.
|
|
40
|
-
* @param d The disposable to unregister.
|
|
41
|
-
*/
|
|
42
|
-
public unregister<T extends IDisposable>(d: T): void {
|
|
43
|
-
const index = this._disposables.indexOf(d);
|
|
44
|
-
if (index !== -1) {
|
|
45
|
-
this._disposables.splice(index, 1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class MutableDisposable<T extends IDisposable> implements IDisposable {
|
|
51
|
-
private _value?: T;
|
|
52
|
-
private _isDisposed = false;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets the value if it exists.
|
|
56
|
-
*/
|
|
57
|
-
public get value(): T | undefined {
|
|
58
|
-
return this._isDisposed ? undefined : this._value;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Sets the value, disposing of the old value if it exists.
|
|
63
|
-
*/
|
|
64
|
-
public set value(value: T | undefined) {
|
|
65
|
-
if (this._isDisposed || value === this._value) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
this._value?.dispose();
|
|
69
|
-
this._value = value;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Resets the stored value and disposes of the previously stored value.
|
|
74
|
-
*/
|
|
75
|
-
public clear(): void {
|
|
76
|
-
this.value = undefined;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public dispose(): void {
|
|
80
|
-
this._isDisposed = true;
|
|
81
|
-
this._value?.dispose();
|
|
82
|
-
this._value = undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Wrap a function in a disposable.
|
|
88
|
-
*/
|
|
89
|
-
export function toDisposable(f: () => void): IDisposable {
|
|
90
|
-
return { dispose: f };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Dispose of all disposables in an array and set its length to 0.
|
|
95
|
-
*/
|
|
96
|
-
export function disposeArray(disposables: IDisposable[]): void {
|
|
97
|
-
for (const d of disposables) {
|
|
98
|
-
d.dispose();
|
|
99
|
-
}
|
|
100
|
-
disposables.length = 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Creates a disposable that will dispose of an array of disposables when disposed.
|
|
105
|
-
*/
|
|
106
|
-
export function getDisposeArrayDisposable(array: IDisposable[]): IDisposable {
|
|
107
|
-
return { dispose: () => disposeArray(array) };
|
|
108
|
-
}
|
|
File without changes
|
|
File without changes
|