@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
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas';
|
|
7
|
-
import { ITerminalOptions, Terminal } from '@xterm/xterm';
|
|
8
|
-
import { ITerminal, ReadonlyColorSet } from 'browser/Types';
|
|
9
|
-
import { ICharAtlasConfig, ITextureAtlas } from 'browser/renderer/shared/Types';
|
|
10
|
-
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
|
|
11
|
-
|
|
12
|
-
interface ITextureAtlasCacheEntry {
|
|
13
|
-
atlas: ITextureAtlas;
|
|
14
|
-
config: ICharAtlasConfig;
|
|
15
|
-
// N.B. This implementation potentially holds onto copies of the terminal forever, so
|
|
16
|
-
// this may cause memory leaks.
|
|
17
|
-
ownedBy: Terminal[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const charAtlasCache: ITextureAtlasCacheEntry[] = [];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Acquires a char atlas, either generating a new one or returning an existing
|
|
24
|
-
* one that is in use by another terminal.
|
|
25
|
-
*/
|
|
26
|
-
export function acquireTextureAtlas(
|
|
27
|
-
terminal: Terminal,
|
|
28
|
-
options: Required<ITerminalOptions>,
|
|
29
|
-
colors: ReadonlyColorSet,
|
|
30
|
-
deviceCellWidth: number,
|
|
31
|
-
deviceCellHeight: number,
|
|
32
|
-
deviceCharWidth: number,
|
|
33
|
-
deviceCharHeight: number,
|
|
34
|
-
devicePixelRatio: number
|
|
35
|
-
): ITextureAtlas {
|
|
36
|
-
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio);
|
|
37
|
-
|
|
38
|
-
// Check to see if the terminal already owns this config
|
|
39
|
-
for (let i = 0; i < charAtlasCache.length; i++) {
|
|
40
|
-
const entry = charAtlasCache[i];
|
|
41
|
-
const ownedByIndex = entry.ownedBy.indexOf(terminal);
|
|
42
|
-
if (ownedByIndex >= 0) {
|
|
43
|
-
if (configEquals(entry.config, newConfig)) {
|
|
44
|
-
return entry.atlas;
|
|
45
|
-
}
|
|
46
|
-
// The configs differ, release the terminal from the entry
|
|
47
|
-
if (entry.ownedBy.length === 1) {
|
|
48
|
-
entry.atlas.dispose();
|
|
49
|
-
charAtlasCache.splice(i, 1);
|
|
50
|
-
} else {
|
|
51
|
-
entry.ownedBy.splice(ownedByIndex, 1);
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Try match a char atlas from the cache
|
|
58
|
-
for (let i = 0; i < charAtlasCache.length; i++) {
|
|
59
|
-
const entry = charAtlasCache[i];
|
|
60
|
-
if (configEquals(entry.config, newConfig)) {
|
|
61
|
-
// Add the terminal to the cache entry and return
|
|
62
|
-
entry.ownedBy.push(terminal);
|
|
63
|
-
return entry.atlas;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const core: ITerminal = (terminal as any)._core;
|
|
68
|
-
const newEntry: ITextureAtlasCacheEntry = {
|
|
69
|
-
atlas: new TextureAtlas(document, newConfig, core.unicodeService),
|
|
70
|
-
config: newConfig,
|
|
71
|
-
ownedBy: [terminal]
|
|
72
|
-
};
|
|
73
|
-
charAtlasCache.push(newEntry);
|
|
74
|
-
return newEntry.atlas;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Removes a terminal reference from the cache, allowing its memory to be freed.
|
|
79
|
-
* @param terminal The terminal to remove.
|
|
80
|
-
*/
|
|
81
|
-
export function removeTerminalFromCache(terminal: Terminal): void {
|
|
82
|
-
for (let i = 0; i < charAtlasCache.length; i++) {
|
|
83
|
-
const index = charAtlasCache[i].ownedBy.indexOf(terminal);
|
|
84
|
-
if (index !== -1) {
|
|
85
|
-
if (charAtlasCache[i].ownedBy.length === 1) {
|
|
86
|
-
// Remove the cache entry if it's the only terminal
|
|
87
|
-
charAtlasCache[i].atlas.dispose();
|
|
88
|
-
charAtlasCache.splice(i, 1);
|
|
89
|
-
} else {
|
|
90
|
-
// Remove the reference from the cache entry
|
|
91
|
-
charAtlasCache[i].ownedBy.splice(index, 1);
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { ICharAtlasConfig } from './Types';
|
|
7
|
-
import { Attributes } from 'common/buffer/Constants';
|
|
8
|
-
import { ITerminalOptions } from '@xterm/xterm';
|
|
9
|
-
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
10
|
-
import { NULL_COLOR } from 'common/Color';
|
|
11
|
-
|
|
12
|
-
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number): ICharAtlasConfig {
|
|
13
|
-
// null out some fields that don't matter
|
|
14
|
-
const clonedColors: IColorSet = {
|
|
15
|
-
foreground: colors.foreground,
|
|
16
|
-
background: colors.background,
|
|
17
|
-
cursor: NULL_COLOR,
|
|
18
|
-
cursorAccent: NULL_COLOR,
|
|
19
|
-
selectionForeground: NULL_COLOR,
|
|
20
|
-
selectionBackgroundTransparent: NULL_COLOR,
|
|
21
|
-
selectionBackgroundOpaque: NULL_COLOR,
|
|
22
|
-
selectionInactiveBackgroundTransparent: NULL_COLOR,
|
|
23
|
-
selectionInactiveBackgroundOpaque: NULL_COLOR,
|
|
24
|
-
// For the static char atlas, we only use the first 16 colors, but we need all 256 for the
|
|
25
|
-
// dynamic character atlas.
|
|
26
|
-
ansi: colors.ansi.slice(),
|
|
27
|
-
contrastCache: colors.contrastCache,
|
|
28
|
-
halfContrastCache: colors.halfContrastCache
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
customGlyphs: options.customGlyphs,
|
|
32
|
-
devicePixelRatio,
|
|
33
|
-
letterSpacing: options.letterSpacing,
|
|
34
|
-
lineHeight: options.lineHeight,
|
|
35
|
-
deviceCellWidth: deviceCellWidth,
|
|
36
|
-
deviceCellHeight: deviceCellHeight,
|
|
37
|
-
deviceCharWidth: deviceCharWidth,
|
|
38
|
-
deviceCharHeight: deviceCharHeight,
|
|
39
|
-
fontFamily: options.fontFamily,
|
|
40
|
-
fontSize: options.fontSize,
|
|
41
|
-
fontWeight: options.fontWeight,
|
|
42
|
-
fontWeightBold: options.fontWeightBold,
|
|
43
|
-
allowTransparency: options.allowTransparency,
|
|
44
|
-
drawBoldTextInBrightColors: options.drawBoldTextInBrightColors,
|
|
45
|
-
minimumContrastRatio: options.minimumContrastRatio,
|
|
46
|
-
colors: clonedColors
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean {
|
|
51
|
-
for (let i = 0; i < a.colors.ansi.length; i++) {
|
|
52
|
-
if (a.colors.ansi[i].rgba !== b.colors.ansi[i].rgba) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return a.devicePixelRatio === b.devicePixelRatio &&
|
|
57
|
-
a.customGlyphs === b.customGlyphs &&
|
|
58
|
-
a.lineHeight === b.lineHeight &&
|
|
59
|
-
a.letterSpacing === b.letterSpacing &&
|
|
60
|
-
a.fontFamily === b.fontFamily &&
|
|
61
|
-
a.fontSize === b.fontSize &&
|
|
62
|
-
a.fontWeight === b.fontWeight &&
|
|
63
|
-
a.fontWeightBold === b.fontWeightBold &&
|
|
64
|
-
a.allowTransparency === b.allowTransparency &&
|
|
65
|
-
a.deviceCharWidth === b.deviceCharWidth &&
|
|
66
|
-
a.deviceCharHeight === b.deviceCharHeight &&
|
|
67
|
-
a.drawBoldTextInBrightColors === b.drawBoldTextInBrightColors &&
|
|
68
|
-
a.minimumContrastRatio === b.minimumContrastRatio &&
|
|
69
|
-
a.colors.foreground.rgba === b.colors.foreground.rgba &&
|
|
70
|
-
a.colors.background.rgba === b.colors.background.rgba;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function is256Color(colorCode: number): boolean {
|
|
74
|
-
return (colorCode & Attributes.CM_MASK) === Attributes.CM_P16 || (colorCode & Attributes.CM_MASK) === Attributes.CM_P256;
|
|
75
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { ICoreBrowserService } from 'browser/services/Services';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The time between cursor blinks.
|
|
10
|
-
*/
|
|
11
|
-
const BLINK_INTERVAL = 600;
|
|
12
|
-
|
|
13
|
-
export class CursorBlinkStateManager {
|
|
14
|
-
public isCursorVisible: boolean;
|
|
15
|
-
|
|
16
|
-
private _animationFrame: number | undefined;
|
|
17
|
-
private _blinkStartTimeout: number | undefined;
|
|
18
|
-
private _blinkInterval: number | undefined;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The time at which the animation frame was restarted, this is used on the
|
|
22
|
-
* next render to restart the timers so they don't need to restart the timers
|
|
23
|
-
* multiple times over a short period.
|
|
24
|
-
*/
|
|
25
|
-
private _animationTimeRestarted: number | undefined;
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
private _renderCallback: () => void,
|
|
29
|
-
private _coreBrowserService: ICoreBrowserService
|
|
30
|
-
) {
|
|
31
|
-
this.isCursorVisible = true;
|
|
32
|
-
if (this._coreBrowserService.isFocused) {
|
|
33
|
-
this._restartInterval();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public get isPaused(): boolean { return !(this._blinkStartTimeout || this._blinkInterval); }
|
|
38
|
-
|
|
39
|
-
public dispose(): void {
|
|
40
|
-
if (this._blinkInterval) {
|
|
41
|
-
this._coreBrowserService.window.clearInterval(this._blinkInterval);
|
|
42
|
-
this._blinkInterval = undefined;
|
|
43
|
-
}
|
|
44
|
-
if (this._blinkStartTimeout) {
|
|
45
|
-
this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout);
|
|
46
|
-
this._blinkStartTimeout = undefined;
|
|
47
|
-
}
|
|
48
|
-
if (this._animationFrame) {
|
|
49
|
-
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
|
50
|
-
this._animationFrame = undefined;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public restartBlinkAnimation(): void {
|
|
55
|
-
if (this.isPaused) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
// Save a timestamp so that the restart can be done on the next interval
|
|
59
|
-
this._animationTimeRestarted = Date.now();
|
|
60
|
-
// Force a cursor render to ensure it's visible and in the correct position
|
|
61
|
-
this.isCursorVisible = true;
|
|
62
|
-
if (!this._animationFrame) {
|
|
63
|
-
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
|
|
64
|
-
this._renderCallback();
|
|
65
|
-
this._animationFrame = undefined;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private _restartInterval(timeToStart: number = BLINK_INTERVAL): void {
|
|
71
|
-
// Clear any existing interval
|
|
72
|
-
if (this._blinkInterval) {
|
|
73
|
-
this._coreBrowserService.window.clearInterval(this._blinkInterval);
|
|
74
|
-
this._blinkInterval = undefined;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Setup the initial timeout which will hide the cursor, this is done before
|
|
78
|
-
// the regular interval is setup in order to support restarting the blink
|
|
79
|
-
// animation in a lightweight way (without thrashing clearInterval and
|
|
80
|
-
// setInterval).
|
|
81
|
-
this._blinkStartTimeout = this._coreBrowserService.window.setTimeout(() => {
|
|
82
|
-
// Check if another animation restart was requested while this was being
|
|
83
|
-
// started
|
|
84
|
-
if (this._animationTimeRestarted) {
|
|
85
|
-
const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);
|
|
86
|
-
this._animationTimeRestarted = undefined;
|
|
87
|
-
if (time > 0) {
|
|
88
|
-
this._restartInterval(time);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Hide the cursor
|
|
94
|
-
this.isCursorVisible = false;
|
|
95
|
-
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
|
|
96
|
-
this._renderCallback();
|
|
97
|
-
this._animationFrame = undefined;
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Setup the blink interval
|
|
101
|
-
this._blinkInterval = this._coreBrowserService.window.setInterval(() => {
|
|
102
|
-
// Adjust the animation time if it was restarted
|
|
103
|
-
if (this._animationTimeRestarted) {
|
|
104
|
-
// calc time diff
|
|
105
|
-
// Make restart interval do a setTimeout initially?
|
|
106
|
-
const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);
|
|
107
|
-
this._animationTimeRestarted = undefined;
|
|
108
|
-
this._restartInterval(time);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Invert visibility and render
|
|
113
|
-
this.isCursorVisible = !this.isCursorVisible;
|
|
114
|
-
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
|
|
115
|
-
this._renderCallback();
|
|
116
|
-
this._animationFrame = undefined;
|
|
117
|
-
});
|
|
118
|
-
}, BLINK_INTERVAL);
|
|
119
|
-
}, timeToStart);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public pause(): void {
|
|
123
|
-
this.isCursorVisible = true;
|
|
124
|
-
if (this._blinkInterval) {
|
|
125
|
-
this._coreBrowserService.window.clearInterval(this._blinkInterval);
|
|
126
|
-
this._blinkInterval = undefined;
|
|
127
|
-
}
|
|
128
|
-
if (this._blinkStartTimeout) {
|
|
129
|
-
this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout);
|
|
130
|
-
this._blinkStartTimeout = undefined;
|
|
131
|
-
}
|
|
132
|
-
if (this._animationFrame) {
|
|
133
|
-
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
|
134
|
-
this._animationFrame = undefined;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public resume(): void {
|
|
139
|
-
// Clear out any existing timers just in case
|
|
140
|
-
this.pause();
|
|
141
|
-
|
|
142
|
-
this._animationTimeRestarted = undefined;
|
|
143
|
-
this._restartInterval();
|
|
144
|
-
this.restartBlinkAnimation();
|
|
145
|
-
}
|
|
146
|
-
}
|