Use shared constant for idle timeout

This commit is contained in:
Daniel Imms
2025-12-28 13:37:25 -08:00
parent 2e1651badd
commit 4985c9f3f9
3 changed files with 11 additions and 15 deletions
@@ -3,6 +3,7 @@
* @license MIT
*/
import { RendererConstants } from 'browser/renderer/shared/Constants';
import { ICoreBrowserService } from 'browser/services/Services';
const enum Constants {
@@ -10,11 +11,6 @@ const enum Constants {
* The time between cursor blinks.
*/
BLINK_INTERVAL = 600,
/**
* The idle time after which cursor blinking stops.
*/
IDLE_TIMEOUT = 5 * 60 * 1000
}
export class CursorBlinkStateManager {
@@ -178,7 +174,7 @@ export class CursorBlinkStateManager {
}
this._idleTimeout = this._coreBrowserService.window.setTimeout(() => {
this._stopBlinkingDueToIdle();
}, Constants.IDLE_TIMEOUT);
}, RendererConstants.CURSOR_BLINK_IDLE_TIMEOUT);
}
/**
+2 -9
View File
@@ -5,7 +5,7 @@
import { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';
import { WidthCache } from 'browser/renderer/dom/WidthCache';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { INVERTED_DEFAULT_COLOR, RendererConstants } from 'browser/renderer/shared/Constants';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';
@@ -26,13 +26,6 @@ const FOCUS_CLASS = 'xterm-focus';
const SELECTION_CLASS = 'xterm-selection';
const CURSOR_BLINK_IDLE_CLASS = 'xterm-cursor-blink-idle';
const enum Constants {
/**
* The idle time after which cursor blinking stops.
*/
IDLE_TIMEOUT = 5 * 60 * 1000
}
let nextTerminalId = 1;
/**
@@ -602,7 +595,7 @@ class CursorBlinkStateManager {
this._clearIdleTimer();
this._idleTimeout = this._coreBrowserService.window.setTimeout(() => {
this._stopBlinkingDueToIdle();
}, Constants.IDLE_TIMEOUT);
}, RendererConstants.CURSOR_BLINK_IDLE_TIMEOUT);
}
private _clearIdleTimer(): void {
+7
View File
@@ -4,3 +4,10 @@
*/
export const INVERTED_DEFAULT_COLOR = 257;
export const enum RendererConstants {
/**
* The idle time after which cursor blinking stops.
*/
CURSOR_BLINK_IDLE_TIMEOUT = 5 * 60 * 1000
}