@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
|
@@ -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,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 { }
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
/// <reference lib="dom"/>
|
|
11
11
|
|
|
12
|
-
declare module 'xterm' {
|
|
12
|
+
declare module '@xterm/xterm' {
|
|
13
13
|
/**
|
|
14
14
|
* A string or number representing text font weight.
|
|
15
15
|
*/
|
|
@@ -47,11 +47,13 @@ declare module '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
|
|
|
@@ -90,17 +92,23 @@ declare module 'xterm' {
|
|
|
90
92
|
disableStdin?: boolean;
|
|
91
93
|
|
|
92
94
|
/**
|
|
93
|
-
*
|
|
95
|
+
* A {@link Document} to use instead of the one that xterm.js was attached
|
|
96
|
+
* to. The purpose of this is to improve support in multi-window
|
|
97
|
+
* applications where HTML elements may be references across multiple
|
|
98
|
+
* windows which can cause problems with `instanceof`.
|
|
99
|
+
*
|
|
100
|
+
* The type is `any` because using `Document` can cause TS to have
|
|
101
|
+
* performance/compiler problems.
|
|
94
102
|
*/
|
|
95
|
-
|
|
103
|
+
documentOverride?: any | null;
|
|
96
104
|
|
|
97
105
|
/**
|
|
98
|
-
*
|
|
106
|
+
* Whether to draw bold text in bright colors. The default is true.
|
|
99
107
|
*/
|
|
100
|
-
|
|
108
|
+
drawBoldTextInBrightColors?: boolean;
|
|
101
109
|
|
|
102
110
|
/**
|
|
103
|
-
* The scroll speed multiplier used for fast scrolling.
|
|
111
|
+
* The scroll speed multiplier used for fast scrolling when `Alt` is held.
|
|
104
112
|
*/
|
|
105
113
|
fastScrollSensitivity?: number;
|
|
106
114
|
|
|
@@ -198,6 +206,30 @@ declare module 'xterm' {
|
|
|
198
206
|
*/
|
|
199
207
|
minimumContrastRatio?: number;
|
|
200
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Whether to reflow the line containing the cursor when the terminal is
|
|
211
|
+
* resized. Defaults to false, because shells usually handle this
|
|
212
|
+
* themselves.
|
|
213
|
+
*/
|
|
214
|
+
reflowCursorLine?: boolean;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Whether to rescale glyphs horizontally that are a single cell wide but
|
|
218
|
+
* have glyphs that would overlap following cell(s). This typically happens
|
|
219
|
+
* for ambiguous width characters (eg. the roman numeral characters U+2160+)
|
|
220
|
+
* which aren't featured in monospace fonts. This is an important feature
|
|
221
|
+
* for achieving GB18030 compliance.
|
|
222
|
+
*
|
|
223
|
+
* The following glyphs will never be rescaled:
|
|
224
|
+
*
|
|
225
|
+
* - Emoji glyphs
|
|
226
|
+
* - Powerline glyphs
|
|
227
|
+
* - Nerd font glyphs
|
|
228
|
+
*
|
|
229
|
+
* Note that this doesn't work with the DOM renderer. The default is false.
|
|
230
|
+
*/
|
|
231
|
+
rescaleOverlappingGlyphs?: boolean;
|
|
232
|
+
|
|
201
233
|
/**
|
|
202
234
|
* Whether to select the word under the cursor on right click, this is
|
|
203
235
|
* standard behavior in a lot of macOS applications.
|
|
@@ -214,10 +246,17 @@ declare module 'xterm' {
|
|
|
214
246
|
/**
|
|
215
247
|
* The amount of scrollback in the terminal. Scrollback is the amount of
|
|
216
248
|
* rows that are retained when lines are scrolled beyond the initial
|
|
217
|
-
* viewport.
|
|
249
|
+
* viewport. Defaults to 1000.
|
|
218
250
|
*/
|
|
219
251
|
scrollback?: number;
|
|
220
252
|
|
|
253
|
+
/**
|
|
254
|
+
* If enabled the Erase in Display All (ED2) escape sequence will push
|
|
255
|
+
* erased text to scrollback, instead of clearing only the viewport portion.
|
|
256
|
+
* This emulates PuTTY's default clear screen behavior.
|
|
257
|
+
*/
|
|
258
|
+
scrollOnEraseInDisplay?: boolean;
|
|
259
|
+
|
|
221
260
|
/**
|
|
222
261
|
* Whether to scroll to the bottom whenever there is some user input. The
|
|
223
262
|
* default is true.
|
|
@@ -245,25 +284,6 @@ declare module 'xterm' {
|
|
|
245
284
|
*/
|
|
246
285
|
theme?: ITheme;
|
|
247
286
|
|
|
248
|
-
/**
|
|
249
|
-
* Whether "Windows mode" is enabled. Because Windows backends winpty and
|
|
250
|
-
* conpty operate by doing line wrapping on their side, xterm.js does not
|
|
251
|
-
* have access to wrapped lines. When Windows mode is enabled the following
|
|
252
|
-
* changes will be in effect:
|
|
253
|
-
*
|
|
254
|
-
* - Reflow is disabled.
|
|
255
|
-
* - Lines are assumed to be wrapped if the last character of the line is
|
|
256
|
-
* not whitespace.
|
|
257
|
-
*
|
|
258
|
-
* When using conpty on Windows 11 version >= 21376, it is recommended to
|
|
259
|
-
* disable this because native text wrapping sequences are output correctly
|
|
260
|
-
* thanks to https://github.com/microsoft/terminal/issues/405
|
|
261
|
-
*
|
|
262
|
-
* @deprecated Use {@link windowsPty}. This value will be ignored if
|
|
263
|
-
* windowsPty is set.
|
|
264
|
-
*/
|
|
265
|
-
windowsMode?: boolean;
|
|
266
|
-
|
|
267
287
|
/**
|
|
268
288
|
* Compatibility information when the pty is known to be hosted on Windows.
|
|
269
289
|
* Setting this will turn on certain heuristics/workarounds depending on the
|
|
@@ -295,10 +315,10 @@ declare module 'xterm' {
|
|
|
295
315
|
windowOptions?: IWindowOptions;
|
|
296
316
|
|
|
297
317
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
318
|
+
* Controls the visibility and style of the overview ruler which visualizes
|
|
319
|
+
* decorations underneath the scroll bar.
|
|
300
320
|
*/
|
|
301
|
-
|
|
321
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
/**
|
|
@@ -338,6 +358,27 @@ declare module 'xterm' {
|
|
|
338
358
|
* be transparent)
|
|
339
359
|
*/
|
|
340
360
|
selectionInactiveBackground?: string;
|
|
361
|
+
/**
|
|
362
|
+
* The scrollbar slider background color. Defaults to
|
|
363
|
+
* {@link ITerminalOptions.foreground foreground} with 20% opacity.
|
|
364
|
+
*/
|
|
365
|
+
scrollbarSliderBackground?: string;
|
|
366
|
+
/**
|
|
367
|
+
* The scrollbar slider background color when hovered. Defaults to
|
|
368
|
+
* {@link ITerminalOptions.foreground foreground} with 40% opacity.
|
|
369
|
+
*/
|
|
370
|
+
scrollbarSliderHoverBackground?: string;
|
|
371
|
+
/**
|
|
372
|
+
* The scrollbar slider background color when clicked. Defaults to
|
|
373
|
+
* {@link ITerminalOptions.foreground foreground} with 50% opacity.
|
|
374
|
+
*/
|
|
375
|
+
scrollbarSliderActiveBackground?: string;
|
|
376
|
+
/**
|
|
377
|
+
* The border color of the overview ruler. This visually separates the
|
|
378
|
+
* terminal from the scroll bar when {@link IOverviewRulerOptions.width} is
|
|
379
|
+
* set. When this is not set it defaults to black (`#000000`).
|
|
380
|
+
*/
|
|
381
|
+
overviewRulerBorder?: string;
|
|
341
382
|
/** ANSI black (eg. `\x1b[30m`) */
|
|
342
383
|
black?: string;
|
|
343
384
|
/** ANSI red (eg. `\x1b[31m`) */
|
|
@@ -558,16 +599,13 @@ declare module 'xterm' {
|
|
|
558
599
|
* What layer to render the decoration at when {@link backgroundColor} or
|
|
559
600
|
* {@link foregroundColor} are used. `'bottom'` will render under the
|
|
560
601
|
* selection, `'top`' will render above the selection\*.
|
|
561
|
-
*
|
|
562
|
-
* *\* The selection will render on top regardless of layer on the canvas
|
|
563
|
-
* renderer due to how it renders selection separately.*
|
|
564
602
|
*/
|
|
565
603
|
readonly layer?: 'bottom' | 'top';
|
|
566
604
|
|
|
567
605
|
/**
|
|
568
606
|
* When defined, renders the decoration in the overview ruler to the right
|
|
569
|
-
* of the terminal. {@link
|
|
570
|
-
*
|
|
607
|
+
* of the terminal. {@link IOverviewRulerOptions.width} must be set in order
|
|
608
|
+
* to see the overview ruler.
|
|
571
609
|
* @param color The color of the decoration.
|
|
572
610
|
* @param position The position of the decoration.
|
|
573
611
|
*/
|
|
@@ -590,6 +628,28 @@ declare module 'xterm' {
|
|
|
590
628
|
tooMuchOutput: string;
|
|
591
629
|
}
|
|
592
630
|
|
|
631
|
+
export interface IOverviewRulerOptions {
|
|
632
|
+
/**
|
|
633
|
+
* When defined, renders decorations in the overview ruler to the right of
|
|
634
|
+
* the terminal. This must be set in order to see the overview ruler.
|
|
635
|
+
* @param color The color of the decoration.
|
|
636
|
+
* @param position The position of the decoration.
|
|
637
|
+
*/
|
|
638
|
+
width?: number;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Whether to show the top border of the overview ruler, which uses the
|
|
642
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
643
|
+
*/
|
|
644
|
+
showTopBorder?: boolean;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Whether to show the bottom border of the overview ruler, which uses the
|
|
648
|
+
* {@link ITheme.overviewRulerBorder} color.
|
|
649
|
+
*/
|
|
650
|
+
showBottomBorder?: boolean;
|
|
651
|
+
}
|
|
652
|
+
|
|
593
653
|
/**
|
|
594
654
|
* Enable various window manipulation and report features
|
|
595
655
|
* (`CSI Ps ; Ps ; Ps t`).
|
|
@@ -952,6 +1012,18 @@ declare module 'xterm' {
|
|
|
952
1012
|
*/
|
|
953
1013
|
focus(): void;
|
|
954
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* Input data to application side. The data is treated the same way input
|
|
1017
|
+
* typed into the terminal would (ie. the {@link onData} event will fire).
|
|
1018
|
+
* @param data The data to forward to the application.
|
|
1019
|
+
* @param wasUserInput Whether the input is genuine user input. This is true
|
|
1020
|
+
* by default and triggers additionalbehavior like focus or selection
|
|
1021
|
+
* clearing. Set this to false if the data sent should not be treated like
|
|
1022
|
+
* user input would, for example passing an escape sequence to the
|
|
1023
|
+
* application.
|
|
1024
|
+
*/
|
|
1025
|
+
input(data: string, wasUserInput?: boolean): void;
|
|
1026
|
+
|
|
955
1027
|
/**
|
|
956
1028
|
* Resizes the terminal. It's best practice to debounce calls to resize,
|
|
957
1029
|
* this will help ensure that the pty can respond to the resize event
|
|
@@ -962,7 +1034,8 @@ declare module 'xterm' {
|
|
|
962
1034
|
resize(columns: number, rows: number): void;
|
|
963
1035
|
|
|
964
1036
|
/**
|
|
965
|
-
* Opens the terminal within an element.
|
|
1037
|
+
* Opens the terminal within an element. This should also be called if the
|
|
1038
|
+
* xterm.js element ever changes browser window.
|
|
966
1039
|
* @param parent The element to create the terminal within. This element
|
|
967
1040
|
* must be visible (have dimensions) when `open` is called as several DOM-
|
|
968
1041
|
* based measurements need to be performed when this function is called.
|
|
@@ -998,6 +1071,28 @@ declare module 'xterm' {
|
|
|
998
1071
|
*/
|
|
999
1072
|
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
|
|
1000
1073
|
|
|
1074
|
+
/**
|
|
1075
|
+
* Attaches a custom wheel event handler which is run before keys are
|
|
1076
|
+
* processed, giving consumers of xterm.js control over whether to proceed
|
|
1077
|
+
* or cancel terminal wheel events.
|
|
1078
|
+
* @param customWheelEventHandler The custom WheelEvent handler to attach.
|
|
1079
|
+
* This is a function that takes a WheelEvent, allowing consumers to stop
|
|
1080
|
+
* propagation and/or prevent the default action. The function returns
|
|
1081
|
+
* whether the event should be processed by xterm.js.
|
|
1082
|
+
*
|
|
1083
|
+
* @example A handler that prevents all wheel events while ctrl is held from
|
|
1084
|
+
* being processed.
|
|
1085
|
+
* ```ts
|
|
1086
|
+
* term.attachCustomWheelEventHandler(ev => {
|
|
1087
|
+
* if (ev.ctrlKey) {
|
|
1088
|
+
* return false;
|
|
1089
|
+
* }
|
|
1090
|
+
* return true;
|
|
1091
|
+
* });
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
1094
|
+
attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void;
|
|
1095
|
+
|
|
1001
1096
|
/**
|
|
1002
1097
|
* Registers a link provider, allowing a custom parser to be used to match
|
|
1003
1098
|
* and handle links. Multiple link providers can be used, they will be asked
|
|
@@ -1027,7 +1122,7 @@ declare module 'xterm' {
|
|
|
1027
1122
|
* render together, since they aren't drawn as optimally as individual
|
|
1028
1123
|
* characters.
|
|
1029
1124
|
*
|
|
1030
|
-
* NOTE: character joiners are only used by the
|
|
1125
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1031
1126
|
*
|
|
1032
1127
|
* @param handler The function that determines character joins. It is called
|
|
1033
1128
|
* with a string of text that is eligible for joining and returns an array
|
|
@@ -1039,7 +1134,7 @@ declare module 'xterm' {
|
|
|
1039
1134
|
|
|
1040
1135
|
/**
|
|
1041
1136
|
* (EXPERIMENTAL) Deregisters the character joiner if one was registered.
|
|
1042
|
-
* NOTE: character joiners are only used by the
|
|
1137
|
+
* NOTE: character joiners are only used by the webgl renderer.
|
|
1043
1138
|
* @param joinerId The character joiner's ID (returned after register)
|
|
1044
1139
|
*/
|
|
1045
1140
|
deregisterCharacterJoiner(joinerId: number): void;
|
|
@@ -1144,21 +1239,31 @@ declare module 'xterm' {
|
|
|
1144
1239
|
|
|
1145
1240
|
/**
|
|
1146
1241
|
* Write data to the terminal.
|
|
1242
|
+
*
|
|
1243
|
+
* Note that the change will not be reflected in the {@link buffer}
|
|
1244
|
+
* immediately as the data is processed asynchronously. Provide a
|
|
1245
|
+
* {@link callback} to know when the data was processed.
|
|
1147
1246
|
* @param data The data to write to the terminal. This can either be raw
|
|
1148
1247
|
* bytes given as Uint8Array from the pty or a string. Raw bytes will always
|
|
1149
1248
|
* be treated as UTF-8 encoded, string data as UTF-16.
|
|
1150
1249
|
* @param callback Optional callback that fires when the data was processed
|
|
1151
|
-
* by the parser.
|
|
1250
|
+
* by the parser. This callback must be provided and awaited in order for
|
|
1251
|
+
* {@link buffer} to reflect the change in the write.
|
|
1152
1252
|
*/
|
|
1153
1253
|
write(data: string | Uint8Array, callback?: () => void): void;
|
|
1154
1254
|
|
|
1155
1255
|
/**
|
|
1156
1256
|
* Writes data to the terminal, followed by a break line character (\n).
|
|
1257
|
+
*
|
|
1258
|
+
* Note that the change will not be reflected in the {@link buffer}
|
|
1259
|
+
* immediately as the data is processed asynchronously. Provide a
|
|
1260
|
+
* {@link callback} to know when the data was processed.
|
|
1157
1261
|
* @param data The data to write to the terminal. This can either be raw
|
|
1158
1262
|
* bytes given as Uint8Array from the pty or a string. Raw bytes will always
|
|
1159
1263
|
* be treated as UTF-8 encoded, string data as UTF-16.
|
|
1160
1264
|
* @param callback Optional callback that fires when the data was processed
|
|
1161
|
-
* by the parser.
|
|
1265
|
+
* by the parser. This callback must be provided and awaited in order for
|
|
1266
|
+
* {@link buffer} to reflect the change in the write.
|
|
1162
1267
|
*/
|
|
1163
1268
|
writeln(data: string | Uint8Array, callback?: () => void): void;
|
|
1164
1269
|
|
|
@@ -1178,7 +1283,7 @@ declare module 'xterm' {
|
|
|
1178
1283
|
refresh(start: number, end: number): void;
|
|
1179
1284
|
|
|
1180
1285
|
/**
|
|
1181
|
-
* Clears the texture atlas of the
|
|
1286
|
+
* Clears the texture atlas of the webgl renderer if it's active. Doing
|
|
1182
1287
|
* this will force a redraw of all glyphs which can workaround issues
|
|
1183
1288
|
* causing the texture to become corrupt, for example Chromium/Nvidia has an
|
|
1184
1289
|
* issue where the texture gets messed up when resuming the OS from sleep.
|
|
@@ -1773,6 +1878,7 @@ declare module 'xterm' {
|
|
|
1773
1878
|
* Unicode version dependent wcwidth implementation.
|
|
1774
1879
|
*/
|
|
1775
1880
|
wcwidth(codepoint: number): 0 | 1 | 2;
|
|
1881
|
+
charProperties(codepoint: number, preceding: number): number;
|
|
1776
1882
|
}
|
|
1777
1883
|
|
|
1778
1884
|
/**
|
|
@@ -1836,6 +1942,13 @@ declare module 'xterm' {
|
|
|
1836
1942
|
* Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
|
|
1837
1943
|
*/
|
|
1838
1944
|
readonly sendFocusMode: boolean;
|
|
1945
|
+
/**
|
|
1946
|
+
* Synchronized Output Mode: `CSI ? 2 0 2 6 h`
|
|
1947
|
+
*
|
|
1948
|
+
* When enabled, output is buffered and only rendered when the mode is
|
|
1949
|
+
* disabled, allowing for atomic screen updates without tearing.
|
|
1950
|
+
*/
|
|
1951
|
+
readonly synchronizedOutputMode: boolean;
|
|
1839
1952
|
/**
|
|
1840
1953
|
* Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
|
|
1841
1954
|
*/
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
## xterm
|
|
1
|
+
## @xterm/addon-fit
|
|
2
2
|
|
|
3
3
|
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables fitting the terminal's dimensions to a containing element. This addon requires xterm.js v4+.
|
|
4
4
|
|
|
5
5
|
### Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install --save xterm
|
|
8
|
+
npm install --save @xterm/addon-fit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
### Usage
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import { Terminal } from 'xterm';
|
|
15
|
-
import { FitAddon } from 'xterm
|
|
14
|
+
import { Terminal } from '@xterm/xterm';
|
|
15
|
+
import { FitAddon } from '@xterm/addon-fit';
|
|
16
16
|
|
|
17
17
|
const terminal = new Terminal();
|
|
18
18
|
const fitAddon = new FitAddon();
|
|
@@ -21,4 +21,4 @@ terminal.open(containerElement);
|
|
|
21
21
|
fitAddon.fit();
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/
|
|
24
|
+
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-fit/typings/addon-fit.d.ts) for more advanced usage.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(globalThis,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;const t=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),o=Math.max(0,parseInt(r.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),n=i-(parseInt(s.getPropertyValue("padding-top"))+parseInt(s.getPropertyValue("padding-bottom"))),l=o-(parseInt(s.getPropertyValue("padding-right"))+parseInt(s.getPropertyValue("padding-left")))-t;return{cols:Math.max(2,Math.floor(l/e.css.cell.width)),rows:Math.max(1,Math.floor(n/e.css.cell.height))}}}})(),e})()));
|
|
2
|
+
//# sourceMappingURL=addon-fit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon-fit.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,GACpB,CATD,CASGK,YAAY,I,mHCgBf,iBAGS,QAAAC,CAASC,GACdC,KAAKC,UAAYF,CACnB,CAEO,OAAAG,GAAiB,CAEjB,GAAAC,GACL,MAAMC,EAAOJ,KAAKK,oBAClB,IAAKD,IAASJ,KAAKC,WAAaK,MAAMF,EAAKG,OAASD,MAAMF,EAAKI,MAC7D,OAIF,MAAMC,EAAQT,KAAKC,UAAkBS,MAGjCV,KAAKC,UAAUO,OAASJ,EAAKI,MAAQR,KAAKC,UAAUM,OAASH,EAAKG,OACpEE,EAAKE,eAAeC,QACpBZ,KAAKC,UAAUY,OAAOT,EAAKG,KAAMH,EAAKI,MAE1C,CAEO,iBAAAH,GACL,IAAKL,KAAKC,UACR,OAGF,IAAKD,KAAKC,UAAUa,UAAYd,KAAKC,UAAUa,QAAQC,cACrD,OAIF,MACMX,EADQJ,KAAKC,UAAkBS,MACAC,eAAeK,WAEpD,GAA4B,IAAxBZ,EAAKa,IAAIC,KAAKC,OAAwC,IAAzBf,EAAKa,IAAIC,KAAKE,OAC7C,OAGF,MAAMC,EAAwD,IAAtCrB,KAAKC,UAAUqB,QAAQC,WAC3C,EACCvB,KAAKC,UAAUqB,QAAQE,eAAeL,OAAS,GAE9CM,EAAqBC,OAAOC,iBAAiB3B,KAAKC,UAAUa,QAAQC,eACpEa,EAAsBC,SAASJ,EAAmBK,iBAAiB,WACnEC,EAAqBC,KAAKC,IAAI,EAAGJ,SAASJ,EAAmBK,iBAAiB,WAC9EI,EAAeR,OAAOC,iBAAiB3B,KAAKC,UAAUa,SAStDqB,EAAkBP,GAPjBC,SAASK,EAAaJ,iBAAiB,gBACpCD,SAASK,EAAaJ,iBAAiB,oBAO3CM,EAAiBL,GANdF,SAASK,EAAaJ,iBAAiB,kBACxCD,SAASK,EAAaJ,iBAAiB,kBAKiBT,EAKhE,MAJiB,CACfd,KAAMyB,KAAKC,IAhEI,EAgEcD,KAAKK,MAAMD,EAAiBhC,EAAKa,IAAIC,KAAKC,QACvEX,KAAMwB,KAAKC,IAhEI,EAgEcD,KAAKK,MAAMF,EAAkB/B,EAAKa,IAAIC,KAAKE,SAG5E,E","sources":["webpack://FitAddon/webpack/universalModuleDefinition","webpack://FitAddon/./src/FitAddon.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FitAddon\"] = factory();\n\telse\n\t\troot[\"FitAddon\"] = factory();\n})(globalThis, () => {\nreturn ","/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport type { Terminal, ITerminalAddon } from '@xterm/xterm';\nimport type { FitAddon as IFitApi } from '@xterm/addon-fit';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { ViewportConstants } from 'browser/shared/Constants';\n\ninterface ITerminalDimensions {\n /**\n * The number of rows in the terminal.\n */\n rows: number;\n\n /**\n * The number of columns in the terminal.\n */\n cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon , IFitApi {\n private _terminal: Terminal | undefined;\n\n public activate(terminal: Terminal): void {\n this._terminal = terminal;\n }\n\n public dispose(): void {}\n\n public fit(): void {\n const dims = this.proposeDimensions();\n if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {\n return;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n\n // Force a full render\n if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n core._renderService.clear();\n this._terminal.resize(dims.cols, dims.rows);\n }\n }\n\n public proposeDimensions(): ITerminalDimensions | undefined {\n if (!this._terminal) {\n return undefined;\n }\n\n if (!this._terminal.element || !this._terminal.element.parentElement) {\n return undefined;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n const dims: IRenderDimensions = core._renderService.dimensions;\n\n if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {\n return undefined;\n }\n\n const scrollbarWidth = (this._terminal.options.scrollback === 0\n ? 0\n : (this._terminal.options.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));\n\n const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n const elementStyle = window.getComputedStyle(this._terminal.element);\n const elementPadding = {\n top: parseInt(elementStyle.getPropertyValue('padding-top')),\n bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n right: parseInt(elementStyle.getPropertyValue('padding-right')),\n left: parseInt(elementStyle.getPropertyValue('padding-left'))\n };\n const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n const elementPaddingHor = elementPadding.right + elementPadding.left;\n const availableHeight = parentElementHeight - elementPaddingVer;\n const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth;\n const geometry = {\n cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)),\n rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height))\n };\n return geometry;\n }\n}\n"],"names":["root","factory","exports","module","define","amd","globalThis","activate","terminal","this","_terminal","dispose","fit","dims","proposeDimensions","isNaN","cols","rows","core","_core","_renderService","clear","resize","element","parentElement","dimensions","css","cell","width","height","scrollbarWidth","options","scrollback","overviewRuler","parentElementStyle","window","getComputedStyle","parentElementHeight","parseInt","getPropertyValue","parentElementWidth","Math","max","elementStyle","availableHeight","availableWidth","floor"],"sourceRoot":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
6
|
+
* @license MIT
|
|
7
|
+
*
|
|
8
|
+
* Originally forked from (with the author's permission):
|
|
9
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
10
|
+
* http://bellard.org/jslinux/
|
|
11
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
12
|
+
*/
|
|
13
|
+
/*---------------------------------------------------------------------------------------------
|
|
14
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
16
|
+
*--------------------------------------------------------------------------------------------*/
|
|
17
|
+
var h=2,_=1,o=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let s=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),i=window.getComputedStyle(this._terminal.element),n={top:parseInt(i.getPropertyValue("padding-top")),bottom:parseInt(i.getPropertyValue("padding-bottom")),right:parseInt(i.getPropertyValue("padding-right")),left:parseInt(i.getPropertyValue("padding-left"))},m=n.top+n.bottom,d=n.right+n.left,c=l-m,p=a-d-s;return{cols:Math.max(h,Math.floor(p/t.css.cell.width)),rows:Math.max(_,Math.floor(c/t.css.cell.height))}}};export{o as FitAddon};
|
|
18
|
+
//# sourceMappingURL=addon-fit.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/FitAddon.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport type { Terminal, ITerminalAddon } from '@xterm/xterm';\nimport type { FitAddon as IFitApi } from '@xterm/addon-fit';\nimport { IRenderDimensions } from 'browser/renderer/shared/Types';\nimport { ViewportConstants } from 'browser/shared/Constants';\n\ninterface ITerminalDimensions {\n /**\n * The number of rows in the terminal.\n */\n rows: number;\n\n /**\n * The number of columns in the terminal.\n */\n cols: number;\n}\n\nconst MINIMUM_COLS = 2;\nconst MINIMUM_ROWS = 1;\n\nexport class FitAddon implements ITerminalAddon , IFitApi {\n private _terminal: Terminal | undefined;\n\n public activate(terminal: Terminal): void {\n this._terminal = terminal;\n }\n\n public dispose(): void {}\n\n public fit(): void {\n const dims = this.proposeDimensions();\n if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {\n return;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n\n // Force a full render\n if (this._terminal.rows !== dims.rows || this._terminal.cols !== dims.cols) {\n core._renderService.clear();\n this._terminal.resize(dims.cols, dims.rows);\n }\n }\n\n public proposeDimensions(): ITerminalDimensions | undefined {\n if (!this._terminal) {\n return undefined;\n }\n\n if (!this._terminal.element || !this._terminal.element.parentElement) {\n return undefined;\n }\n\n // TODO: Remove reliance on private API\n const core = (this._terminal as any)._core;\n const dims: IRenderDimensions = core._renderService.dimensions;\n\n if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {\n return undefined;\n }\n\n const scrollbarWidth = (this._terminal.options.scrollback === 0\n ? 0\n : (this._terminal.options.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));\n\n const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);\n const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));\n const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));\n const elementStyle = window.getComputedStyle(this._terminal.element);\n const elementPadding = {\n top: parseInt(elementStyle.getPropertyValue('padding-top')),\n bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),\n right: parseInt(elementStyle.getPropertyValue('padding-right')),\n left: parseInt(elementStyle.getPropertyValue('padding-left'))\n };\n const elementPaddingVer = elementPadding.top + elementPadding.bottom;\n const elementPaddingHor = elementPadding.right + elementPadding.left;\n const availableHeight = parentElementHeight - elementPaddingVer;\n const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth;\n const geometry = {\n cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)),\n rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height))\n };\n return geometry;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAsBA,IAAMA,EAAe,EACfC,EAAe,EAERC,EAAN,KAAmD,CAGjD,SAASC,EAA0B,CACxC,KAAK,UAAYA,CACnB,CAEO,SAAgB,CAAC,CAEjB,KAAY,CACjB,IAAMC,EAAO,KAAK,kBAAkB,EACpC,GAAI,CAACA,GAAQ,CAAC,KAAK,WAAa,MAAMA,EAAK,IAAI,GAAK,MAAMA,EAAK,IAAI,EACjE,OAIF,IAAMC,EAAQ,KAAK,UAAkB,OAGjC,KAAK,UAAU,OAASD,EAAK,MAAQ,KAAK,UAAU,OAASA,EAAK,QACpEC,EAAK,eAAe,MAAM,EAC1B,KAAK,UAAU,OAAOD,EAAK,KAAMA,EAAK,IAAI,EAE9C,CAEO,mBAAqD,CAK1D,GAJI,CAAC,KAAK,WAIN,CAAC,KAAK,UAAU,SAAW,CAAC,KAAK,UAAU,QAAQ,cACrD,OAKF,IAAMA,EADQ,KAAK,UAAkB,MACA,eAAe,WAEpD,GAAIA,EAAK,IAAI,KAAK,QAAU,GAAKA,EAAK,IAAI,KAAK,SAAW,EACxD,OAGF,IAAME,EAAkB,KAAK,UAAU,QAAQ,aAAe,EAC1D,EACC,KAAK,UAAU,QAAQ,eAAe,OAAS,GAE9CC,EAAqB,OAAO,iBAAiB,KAAK,UAAU,QAAQ,aAAa,EACjFC,EAAsB,SAASD,EAAmB,iBAAiB,QAAQ,CAAC,EAC5EE,EAAqB,KAAK,IAAI,EAAG,SAASF,EAAmB,iBAAiB,OAAO,CAAC,CAAC,EACvFG,EAAe,OAAO,iBAAiB,KAAK,UAAU,OAAO,EAC7DC,EAAiB,CACrB,IAAK,SAASD,EAAa,iBAAiB,aAAa,CAAC,EAC1D,OAAQ,SAASA,EAAa,iBAAiB,gBAAgB,CAAC,EAChE,MAAO,SAASA,EAAa,iBAAiB,eAAe,CAAC,EAC9D,KAAM,SAASA,EAAa,iBAAiB,cAAc,CAAC,CAC9D,EACME,EAAoBD,EAAe,IAAMA,EAAe,OACxDE,EAAoBF,EAAe,MAAQA,EAAe,KAC1DG,EAAkBN,EAAsBI,EACxCG,EAAiBN,EAAqBI,EAAoBP,EAKhE,MAJiB,CACf,KAAM,KAAK,IAAIN,EAAc,KAAK,MAAMe,EAAiBX,EAAK,IAAI,KAAK,KAAK,CAAC,EAC7E,KAAM,KAAK,IAAIH,EAAc,KAAK,MAAMa,EAAkBV,EAAK,IAAI,KAAK,MAAM,CAAC,CACjF,CAEF,CACF",
|
|
6
|
+
"names": ["MINIMUM_COLS", "MINIMUM_ROWS", "FitAddon", "terminal", "dims", "core", "scrollbarWidth", "parentElementStyle", "parentElementHeight", "parentElementWidth", "elementStyle", "elementPadding", "elementPaddingVer", "elementPaddingHor", "availableHeight", "availableWidth"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "xterm
|
|
3
|
-
"version": "0.
|
|
2
|
+
"name": "@xterm/addon-fit",
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "The xterm.js authors",
|
|
6
6
|
"url": "https://xtermjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"main": "lib/
|
|
9
|
-
"
|
|
10
|
-
"
|
|
8
|
+
"main": "lib/addon-fit.js",
|
|
9
|
+
"module": "lib/addon-fit.mjs",
|
|
10
|
+
"types": "typings/addon-fit.d.ts",
|
|
11
|
+
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit",
|
|
11
12
|
"license": "MIT",
|
|
12
13
|
"keywords": [
|
|
13
14
|
"terminal",
|
|
@@ -18,9 +19,8 @@
|
|
|
18
19
|
"build": "../../node_modules/.bin/tsc -p .",
|
|
19
20
|
"prepackage": "npm run build",
|
|
20
21
|
"package": "../../node_modules/.bin/webpack",
|
|
21
|
-
"prepublishOnly": "npm run package"
|
|
22
|
+
"prepublishOnly": "npm run package",
|
|
23
|
+
"start": "node ../../demo/start"
|
|
22
24
|
},
|
|
23
|
-
"
|
|
24
|
-
"xterm": "^5.0.0"
|
|
25
|
-
}
|
|
25
|
+
"commit": "f447274f430fd22513f6adbf9862d19524471c04"
|
|
26
26
|
}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Terminal, ITerminalAddon } from 'xterm';
|
|
6
|
+
import type { Terminal, ITerminalAddon } from '@xterm/xterm';
|
|
7
|
+
import type { FitAddon as IFitApi } from '@xterm/addon-fit';
|
|
7
8
|
import { IRenderDimensions } from 'browser/renderer/shared/Types';
|
|
9
|
+
import { ViewportConstants } from 'browser/shared/Constants';
|
|
8
10
|
|
|
9
11
|
interface ITerminalDimensions {
|
|
10
12
|
/**
|
|
@@ -21,7 +23,7 @@ interface ITerminalDimensions {
|
|
|
21
23
|
const MINIMUM_COLS = 2;
|
|
22
24
|
const MINIMUM_ROWS = 1;
|
|
23
25
|
|
|
24
|
-
export class FitAddon implements ITerminalAddon {
|
|
26
|
+
export class FitAddon implements ITerminalAddon , IFitApi {
|
|
25
27
|
private _terminal: Terminal | undefined;
|
|
26
28
|
|
|
27
29
|
public activate(terminal: Terminal): void {
|
|
@@ -63,8 +65,9 @@ export class FitAddon implements ITerminalAddon {
|
|
|
63
65
|
return undefined;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
const scrollbarWidth = this._terminal.options.scrollback === 0
|
|
67
|
-
0
|
|
68
|
+
const scrollbarWidth = (this._terminal.options.scrollback === 0
|
|
69
|
+
? 0
|
|
70
|
+
: (this._terminal.options.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));
|
|
68
71
|
|
|
69
72
|
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
|
|
70
73
|
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|