mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Const enum over magic number
This commit is contained in:
@@ -22,6 +22,11 @@ interface ITerminalDimensions {
|
||||
const MINIMUM_COLS = 2;
|
||||
const MINIMUM_ROWS = 1;
|
||||
|
||||
// Must remain in sync with the value in core's viewport
|
||||
const enum Constants {
|
||||
DEFAULT_SCROLL_BAR_WIDTH = 14
|
||||
}
|
||||
|
||||
export class FitAddon implements ITerminalAddon , IFitApi {
|
||||
private _terminal: Terminal | undefined;
|
||||
|
||||
@@ -66,7 +71,7 @@ export class FitAddon implements ITerminalAddon , IFitApi {
|
||||
|
||||
const scrollbarWidth = (this._terminal.options.scrollback === 0
|
||||
? 0
|
||||
: (this._terminal.options.overviewRulerWidth || 14));
|
||||
: (this._terminal.options.overviewRulerWidth || Constants.DEFAULT_SCROLL_BAR_WIDTH));
|
||||
|
||||
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
|
||||
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|
||||
|
||||
@@ -11,7 +11,11 @@ import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableEle
|
||||
import type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||
import { ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';
|
||||
|
||||
export class Viewport extends Disposable{
|
||||
const enum Constants {
|
||||
DEFAULT_SCROLL_BAR_WIDTH = 14
|
||||
}
|
||||
|
||||
export class Viewport extends Disposable {
|
||||
|
||||
protected _onRequestScrollLines = this.register(new EventEmitter<number>());
|
||||
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
|
||||
@@ -86,7 +90,7 @@ export class Viewport extends Disposable{
|
||||
return {
|
||||
mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,
|
||||
fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,
|
||||
verticalScrollbarSize: this._optionsService.rawOptions.overviewRulerWidth || 14
|
||||
verticalScrollbarSize: this._optionsService.rawOptions.overviewRulerWidth || Constants.DEFAULT_SCROLL_BAR_WIDTH
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user