Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd6a339bcb | ||
|
|
a2552053f5 | ||
|
|
f3783729aa | ||
|
|
a97b77af3f | ||
|
|
275d6d8a80 | ||
|
|
8679eba407 | ||
|
|
3960db39a9 | ||
|
|
ff8a0d9c99 | ||
|
|
6fd6003d6c | ||
|
|
d407bf561f | ||
|
|
a1a8d1abae | ||
|
|
f34d0a255c | ||
|
|
a2cd1ab29c | ||
|
|
99550840d2 | ||
|
|
b0f6aed4a1 | ||
|
|
878e3fc52d | ||
|
|
f04679a42e | ||
|
|
6ebcf79358 | ||
|
|
d4acf2fa45 | ||
|
|
ddf2b7d091 | ||
|
|
5684f95c8e | ||
|
|
cd3dcc52b2 | ||
|
|
56a7195487 |
+3
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
"import",
|
||||||
"typescript"
|
"typescript"
|
||||||
],
|
],
|
||||||
"categories": {
|
"categories": {
|
||||||
@@ -104,7 +105,8 @@
|
|||||||
"typescript/no-wrapper-object-types": "error",
|
"typescript/no-wrapper-object-types": "error",
|
||||||
"typescript/prefer-as-const": "error",
|
"typescript/prefer-as-const": "error",
|
||||||
"typescript/prefer-namespace-keyword": "error",
|
"typescript/prefer-namespace-keyword": "error",
|
||||||
"typescript/triple-slash-reference": "error"
|
"typescript/triple-slash-reference": "error",
|
||||||
|
"import/no-cycle": "error"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ export class FitAddon implements ITerminalAddon, IFitApi {
|
|||||||
: (this._terminal.options.scrollbar?.width ?? ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));
|
: (this._terminal.options.scrollbar?.width ?? ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH));
|
||||||
|
|
||||||
const parentElementStyle = _getComputedStyle(this._terminal.element.parentElement);
|
const parentElementStyle = _getComputedStyle(this._terminal.element.parentElement);
|
||||||
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
|
const parentElementHeight = Math.max(0, parseInt(parentElementStyle.getPropertyValue('height'), 10) || 0);
|
||||||
const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));
|
const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width'), 10) || 0);
|
||||||
const elementStyle = _getComputedStyle(this._terminal.element);
|
const elementStyle = _getComputedStyle(this._terminal.element);
|
||||||
const elementPadding = {
|
const elementPadding = {
|
||||||
top: parseInt(elementStyle.getPropertyValue('padding-top')),
|
top: parseInt(elementStyle.getPropertyValue('padding-top'), 10) || 0,
|
||||||
bottom: parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
bottom: parseInt(elementStyle.getPropertyValue('padding-bottom'), 10) || 0,
|
||||||
right: parseInt(elementStyle.getPropertyValue('padding-right')),
|
right: parseInt(elementStyle.getPropertyValue('padding-right'), 10) || 0,
|
||||||
left: parseInt(elementStyle.getPropertyValue('padding-left'))
|
left: parseInt(elementStyle.getPropertyValue('padding-left'), 10) || 0
|
||||||
};
|
};
|
||||||
const elementPaddingVer = elementPadding.top + elementPadding.bottom;
|
const elementPaddingVer = elementPadding.top + elementPadding.bottom;
|
||||||
const elementPaddingHor = elementPadding.right + elementPadding.left;
|
const elementPaddingHor = elementPadding.right + elementPadding.left;
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ export class IIPHandler implements IOscHandler, IResetHandler {
|
|||||||
|
|
||||||
private _dim(s: string, total: number, cdim: number): number {
|
private _dim(s: string, total: number, cdim: number): number {
|
||||||
if (s === 'auto') return 0;
|
if (s === 'auto') return 0;
|
||||||
if (s.endsWith('%')) return parseInt(s.slice(0, -1)) * total / 100;
|
if (s.endsWith('%')) return parseInt(s.slice(0, -1), 10) * total / 100;
|
||||||
if (s.endsWith('px')) return parseInt(s.slice(0, -2));
|
if (s.endsWith('px')) return parseInt(s.slice(0, -2), 10);
|
||||||
return parseInt(s) * cdim;
|
return parseInt(s, 10) * cdim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import { IDisposable, IMarker, Terminal } from '@xterm/xterm';
|
|||||||
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
|
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
|
||||||
import type { AttributeData } from 'common/buffer/AttributeData';
|
import type { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
|
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
|
||||||
import type { IBufferLine, IExtendedAttrs, IInputHandler } from 'common/Types';
|
import type { IInputHandler } from 'common/Types';
|
||||||
|
import type { IBufferLine, IExtendedAttrs } from 'common/buffer/Types';
|
||||||
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
|
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
|
||||||
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
|
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
|
||||||
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export function parseKittyCommand(data: string): IKittyCommand {
|
|||||||
cmd.deleteSelector = value;
|
cmd.deleteSelector = value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const numValue = parseInt(value);
|
const numValue = parseInt(value, 10);
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case KittyKey.FORMAT: cmd.format = numValue; break;
|
case KittyKey.FORMAT: cmd.format = numValue; break;
|
||||||
case KittyKey.ID: cmd.id = numValue; break;
|
case KittyKey.ID: cmd.id = numValue; break;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
|
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
|
||||||
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
|
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
|
||||||
import { IAttributeData, IColor } from 'common/Types';
|
import { IColor } from 'common/Types';
|
||||||
|
import { IAttributeData } from 'common/buffer/Types';
|
||||||
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
|
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
|
||||||
import { UnderlineStyle } from 'common/buffer/Constants';
|
import { UnderlineStyle } from 'common/buffer/Constants';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
|||||||
import { ReadonlyColorSet } from 'browser/Types';
|
import { ReadonlyColorSet } from 'browser/Types';
|
||||||
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
|
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
|
||||||
import { IDecorationService, IOptionsService } from 'common/services/Services';
|
import { IDecorationService, IOptionsService } from 'common/services/Services';
|
||||||
import { ICellData } from 'common/Types';
|
import { ICellData } from 'common/buffer/Types';
|
||||||
import { Terminal } from '@xterm/xterm';
|
import { Terminal } from '@xterm/xterm';
|
||||||
import { rgba } from 'common/Color';
|
import { rgba } from 'common/Color';
|
||||||
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
|
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { CursorBlinkStateManager } from './CursorBlinkStateManager';
|
|||||||
import { observeDevicePixelDimensions } from './DevicePixelObserver';
|
import { observeDevicePixelDimensions } from './DevicePixelObserver';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
|
||||||
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||||
import { CharData, IBufferLine, ICellData } from 'common/Types';
|
import { CharData, IBufferLine, ICellData } from 'common/buffer/Types';
|
||||||
import { AttributeData } from 'common/buffer/AttributeData';
|
import { AttributeData } from 'common/buffer/AttributeData';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
|
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ function drawPathDefinitionCharacter(
|
|||||||
const rx = parseFloat(args[0]) * deviceCellWidth;
|
const rx = parseFloat(args[0]) * deviceCellWidth;
|
||||||
const ry = parseFloat(args[1]) * deviceCellHeight;
|
const ry = parseFloat(args[1]) * deviceCellHeight;
|
||||||
const xAxisRotation = parseFloat(args[2]) * Math.PI / 180;
|
const xAxisRotation = parseFloat(args[2]) * Math.PI / 180;
|
||||||
const largeArcFlag = parseInt(args[3]);
|
const largeArcFlag = parseInt(args[3], 10);
|
||||||
const sweepFlag = parseInt(args[4]);
|
const sweepFlag = parseInt(args[4], 10);
|
||||||
const x = xOffset + parseFloat(args[5]) * deviceCellWidth;
|
const x = xOffset + parseFloat(args[5]) * deviceCellWidth;
|
||||||
const y = yOffset + parseFloat(args[6]) * deviceCellHeight;
|
const y = yOffset + parseFloat(args[6]) * deviceCellHeight;
|
||||||
drawSvgArc(ctx, currentX, currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
|
drawSvgArc(ctx, currentX, currentY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y);
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
|
|||||||
this.textarea,
|
this.textarea,
|
||||||
parent.ownerDocument.defaultView ?? window,
|
parent.ownerDocument.defaultView ?? window,
|
||||||
// Force unsafe null in node.js environment for tests
|
// Force unsafe null in node.js environment for tests
|
||||||
this._document ?? (typeof window !== 'undefined') ? window.document : null as any
|
this._document ?? ((typeof window !== 'undefined') ? window.document : null as any)
|
||||||
));
|
));
|
||||||
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
|
this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import { OscLinkProvider } from './OscLinkProvider';
|
|||||||
import { ILink } from './Types';
|
import { ILink } from './Types';
|
||||||
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
|
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
|
||||||
import { IBufferService, IOscLinkService } from '../common/services/Services';
|
import { IBufferService, IOscLinkService } from '../common/services/Services';
|
||||||
import { IBufferLine, IOscLinkData } from '../common/Types';
|
import { IOscLinkData } from '../common/Types';
|
||||||
|
import { IBufferLine } from '../common/buffer/Types';
|
||||||
|
|
||||||
class TestOscLinkService implements IOscLinkService {
|
class TestOscLinkService implements IOscLinkService {
|
||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { IBufferRange, ILink } from './Types';
|
import { IBufferRange, ILink } from './Types';
|
||||||
import { ILinkProvider } from './services/Services';
|
import { ILinkProvider } from './services/Services';
|
||||||
import { CellData } from '../common/buffer/CellData';
|
import { CellData } from '../common/buffer/CellData';
|
||||||
import { IBufferLine } from '../common/Types';
|
import { IBufferLine } from '../common/buffer/Types';
|
||||||
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
|
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
|
||||||
|
|
||||||
export class OscLinkProvider implements ILinkProvider {
|
export class OscLinkProvider implements ILinkProvider {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
if (this._animationFrame) {
|
if (this._animationFrame !== undefined) {
|
||||||
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
|
||||||
this._animationFrame = undefined;
|
this._animationFrame = undefined;
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
|
|
||||||
public addRefreshCallback(callback: FrameRequestCallback): number {
|
public addRefreshCallback(callback: FrameRequestCallback): number {
|
||||||
this._refreshCallbacks.push(callback);
|
this._refreshCallbacks.push(callback);
|
||||||
if (!this._animationFrame) {
|
if (this._animationFrame === undefined) {
|
||||||
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
|
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
|
||||||
}
|
}
|
||||||
return this._animationFrame;
|
return this._animationFrame;
|
||||||
@@ -46,7 +46,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
|
|||||||
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;
|
this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;
|
||||||
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;
|
this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;
|
||||||
|
|
||||||
if (this._animationFrame) {
|
if (this._animationFrame !== undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { assert } from 'chai';
|
|||||||
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
||||||
import { CellData } from '../common/buffer/CellData';
|
import { CellData } from '../common/buffer/CellData';
|
||||||
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
|
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
|
||||||
import { IMarker } from '../common/Types';
|
import { IMarker } from '../common/buffer/Types';
|
||||||
|
|
||||||
const INIT_COLS = 80;
|
const INIT_COLS = 80;
|
||||||
const INIT_ROWS = 24;
|
const INIT_ROWS = 24;
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, I
|
|||||||
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
|
||||||
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
|
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
|
||||||
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from './Types';
|
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from './Types';
|
||||||
import { IBuffer, IBufferSet } from '../common/buffer/Types';
|
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, ICellData } from '../common/buffer/Types';
|
||||||
import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
|
import { ICircularList } from '../common/CircularList';
|
||||||
|
import { XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
|
||||||
import { Buffer } from '../common/buffer/Buffer';
|
import { Buffer } from '../common/buffer/Buffer';
|
||||||
import * as Browser from '../common/Platform';
|
import * as Browser from '../common/Platform';
|
||||||
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
|
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
|
|
||||||
|
|
||||||
import { IRenderDebouncer } from './Types';
|
import { IRenderDebouncer } from './Types';
|
||||||
|
|
||||||
|
const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debounces calls to update screen readers to update at most once configurable interval of time.
|
* Debounces calls to update screen readers to update at most once configurable interval of time.
|
||||||
*/
|
*/
|
||||||
@@ -31,7 +31,9 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
|
|||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
if (this._refreshTimeoutID) {
|
if (this._refreshTimeoutID) {
|
||||||
clearTimeout(this._refreshTimeoutID);
|
clearTimeout(this._refreshTimeoutID);
|
||||||
|
this._refreshTimeoutID = undefined;
|
||||||
}
|
}
|
||||||
|
this._additionalRefreshRequested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {
|
public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {
|
||||||
@@ -47,7 +49,12 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
|
|||||||
// enough time to pass before refreshing again.
|
// enough time to pass before refreshing again.
|
||||||
const refreshRequestTime: number = performance.now();
|
const refreshRequestTime: number = performance.now();
|
||||||
if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
|
if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
|
||||||
// Enough time has lapsed since the last refresh; refresh immediately
|
// Enough time has elapsed since the last refresh; refresh immediately
|
||||||
|
if (this._refreshTimeoutID !== undefined) {
|
||||||
|
clearTimeout(this._refreshTimeoutID);
|
||||||
|
this._refreshTimeoutID = undefined;
|
||||||
|
this._additionalRefreshRequested = false;
|
||||||
|
}
|
||||||
this._lastRefreshMs = refreshRequestTime;
|
this._lastRefreshMs = refreshRequestTime;
|
||||||
this._innerRefresh();
|
this._innerRefresh();
|
||||||
} else if (!this._additionalRefreshRequested) {
|
} else if (!this._additionalRefreshRequested) {
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, IColor, ICoreTerminal, ITerminalOptions } from '../common/Types';
|
import { IColor, ITerminalOptions } from '../common/Types';
|
||||||
import { IBuffer } from '../common/buffer/Types';
|
import { CharData, IBuffer } from '../common/buffer/Types';
|
||||||
|
import { ICoreTerminal } from '../common/CoreTerminal';
|
||||||
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
|
||||||
import { channels, css } from '../common/Color';
|
import { channels, css } from '../common/Color';
|
||||||
import type { IEvent } from '../common/Event';
|
import type { IEvent } from '../common/Event';
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {
|
export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyle'>, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
const elementStyle = window.getComputedStyle(element);
|
const elementStyle = window.getComputedStyle(element);
|
||||||
const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));
|
const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'), 10);
|
||||||
const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));
|
const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'), 10);
|
||||||
return [
|
return [
|
||||||
event.clientX - rect.left - leftPadding,
|
event.clientX - rect.left - leftPadding,
|
||||||
event.clientY - rect.top - topPadding
|
event.clientY - rect.top - topPadding
|
||||||
@@ -22,7 +22,7 @@ export function getCoordsRelativeToElement(window: Pick<Window, 'getComputedStyl
|
|||||||
* @param event The mouse event.
|
* @param event The mouse event.
|
||||||
* @param element The terminal's container element.
|
* @param element The terminal's container element.
|
||||||
* @param colCount The number of columns in the terminal.
|
* @param colCount The number of columns in the terminal.
|
||||||
* @param rowCount The number of rows n the terminal.
|
* @param rowCount The number of rows in the terminal.
|
||||||
* @param hasValidCharSize Whether there is a valid character size available.
|
* @param hasValidCharSize Whether there is a valid character size available.
|
||||||
* @param cssCellWidth The cell width device pixel render dimensions.
|
* @param cssCellWidth The cell width device pixel render dimensions.
|
||||||
* @param cssCellHeight The cell height device pixel render dimensions.
|
* @param cssCellHeight The cell height device pixel render dimensions.
|
||||||
@@ -37,10 +37,6 @@ export function getCoords(window: Pick<Window, 'getComputedStyle'>, event: Pick<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const coords = getCoordsRelativeToElement(window, event, element);
|
const coords = getCoordsRelativeToElement(window, event, element);
|
||||||
if (!coords) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
|
||||||
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
coords[1] = Math.ceil(coords[1] / cssCellHeight);
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ function wrappedRowsForRow(currentRow: number, bufferService: IBufferService): n
|
|||||||
*/
|
*/
|
||||||
function horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {
|
function horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {
|
||||||
let startRow;
|
let startRow;
|
||||||
if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {
|
if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {
|
||||||
startRow = targetY - wrappedRowsForRow(targetY, bufferService);
|
startRow = targetY - wrappedRowsForRow(targetY, bufferService);
|
||||||
} else {
|
} else {
|
||||||
startRow = startY;
|
startRow = startY;
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ class CursorBlinkStateManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _clearIdleTimer(): void {
|
private _clearIdleTimer(): void {
|
||||||
if (this._idleTimeout) {
|
if (this._idleTimeout !== undefined) {
|
||||||
this._coreBrowserService.window.clearTimeout(this._idleTimeout);
|
this._coreBrowserService.window.clearTimeout(this._idleTimeout);
|
||||||
this._idleTimeout = undefined;
|
this._idleTimeout = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { DomRendererRowFactory } from './DomRendererRowFactory';
|
|||||||
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from '../../../common/buffer/Constants';
|
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from '../../../common/buffer/Constants';
|
||||||
import { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/buffer/BufferLine';
|
import { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferLine } from '../../../common/Types';
|
import { IBufferLine } from '../../../common/buffer/Types';
|
||||||
import { CellData } from '../../../common/buffer/CellData';
|
import { CellData } from '../../../common/buffer/CellData';
|
||||||
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
|
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
|
||||||
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
|
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IBufferLine, ICellData, IColor } from '../../../common/Types';
|
import { IColor } from '../../../common/Types';
|
||||||
|
import { IBufferLine, ICellData } from '../../../common/buffer/Types';
|
||||||
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
|
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
|
||||||
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
|
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
|
||||||
import { CellData } from '../../../common/buffer/CellData';
|
import { CellData } from '../../../common/buffer/CellData';
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ export class StandardWheelEvent {
|
|||||||
let shouldFactorDPR: boolean = false;
|
let shouldFactorDPR: boolean = false;
|
||||||
if (platform.isChrome) {
|
if (platform.isChrome) {
|
||||||
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
|
||||||
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;
|
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1], 10) : 123;
|
||||||
shouldFactorDPR = chromeMajorVersion <= 122;
|
shouldFactorDPR = chromeMajorVersion <= 122;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ICharacterJoinerService } from './Services';
|
|||||||
import { CharacterJoinerService } from './CharacterJoinerService';
|
import { CharacterJoinerService } from './CharacterJoinerService';
|
||||||
import { BufferLine } from '../../common/buffer/BufferLine';
|
import { BufferLine } from '../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferLine } from '../../common/Types';
|
import { IBufferLine } from '../../common/buffer/Types';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
|
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IBufferLine, ICellData, CharData } from '../../common/Types';
|
import { CharData, IBufferLine, ICellData } from '../../common/buffer/Types';
|
||||||
import { ICharacterJoiner } from '../Types';
|
import { ICharacterJoiner } from '../Types';
|
||||||
import { AttributeData } from '../../common/buffer/AttributeData';
|
import { AttributeData } from '../../common/buffer/AttributeData';
|
||||||
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
|
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
|
||||||
|
|||||||
@@ -6,14 +6,13 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { SelectionService, SelectionMode } from './SelectionService';
|
import { SelectionService, SelectionMode } from './SelectionService';
|
||||||
import { SelectionModel } from '../selection/SelectionModel';
|
import { SelectionModel } from '../selection/SelectionModel';
|
||||||
import { IBufferLine } from '../../common/Types';
|
import { IBuffer, IBufferLine } from '../../common/buffer/Types';
|
||||||
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
|
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
|
||||||
import { BufferLine } from '../../common/buffer/BufferLine';
|
import { BufferLine } from '../../common/buffer/BufferLine';
|
||||||
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
|
||||||
import { IBufferService, IOptionsService } from '../../common/services/Services';
|
import { IBufferService, IOptionsService } from '../../common/services/Services';
|
||||||
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
|
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
import { IBuffer } from '../../common/buffer/Types';
|
|
||||||
import { IRenderService } from './Services';
|
import { IRenderService } from './Services';
|
||||||
|
|
||||||
const TEST_STRING_CACHE = new BufferLineStringCache();
|
const TEST_STRING_CACHE = new BufferLineStringCache();
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from
|
|||||||
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
|
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
|
||||||
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
|
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
|
||||||
import * as Browser from '../../common/Platform';
|
import * as Browser from '../../common/Platform';
|
||||||
import { IBufferLine, ICellData, IDisposable } from '../../common/Types';
|
import { IDisposable } from '../../common/Types';
|
||||||
|
import { IBuffer, IBufferLine, ICellData } from '../../common/buffer/Types';
|
||||||
import { getRangeLength } from '../../common/buffer/BufferRange';
|
import { getRangeLength } from '../../common/buffer/BufferRange';
|
||||||
import { CellData } from '../../common/buffer/CellData';
|
import { CellData } from '../../common/buffer/CellData';
|
||||||
import { IBuffer } from '../../common/buffer/Types';
|
|
||||||
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
|
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
|
||||||
import { Emitter } from '../../common/Event';
|
import { Emitter } from '../../common/Event';
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICircularList } from './Types';
|
|
||||||
import { Disposable } from './Lifecycle';
|
import { Disposable } from './Lifecycle';
|
||||||
import { Emitter } from './Event';
|
import { Emitter, type IEvent } from './Event';
|
||||||
|
|
||||||
export interface IInsertEvent {
|
export interface IInsertEvent {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -17,6 +16,28 @@ export interface IDeleteEvent {
|
|||||||
amount: number;
|
amount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ICircularList<T> {
|
||||||
|
length: number;
|
||||||
|
maxLength: number;
|
||||||
|
isFull: boolean;
|
||||||
|
|
||||||
|
onDeleteEmitter: Emitter<IDeleteEvent>;
|
||||||
|
onDelete: IEvent<IDeleteEvent>;
|
||||||
|
onInsertEmitter: Emitter<IInsertEvent>;
|
||||||
|
onInsert: IEvent<IInsertEvent>;
|
||||||
|
onTrimEmitter: Emitter<number>;
|
||||||
|
onTrim: IEvent<number>;
|
||||||
|
|
||||||
|
get(index: number): T | undefined;
|
||||||
|
set(index: number, value: T): void;
|
||||||
|
push(value: T): void;
|
||||||
|
recycle(): T;
|
||||||
|
pop(): T | undefined;
|
||||||
|
splice(start: number, deleteCount: number, ...items: T[]): void;
|
||||||
|
trimStart(count: number): void;
|
||||||
|
shiftElements(start: number, count: number, offset: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a circular list; a list with a maximum size that wraps around when push is called,
|
* Represents a circular list; a list with a maximum size that wraps around when push is called,
|
||||||
* overriding values at the start of the list.
|
* overriding values at the start of the list.
|
||||||
|
|||||||
+3
-3
@@ -177,9 +177,9 @@ export namespace css {
|
|||||||
// Formats: rgb() or rgba()
|
// Formats: rgb() or rgba()
|
||||||
const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
|
const rgbaMatch = css.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
|
||||||
if (rgbaMatch) {
|
if (rgbaMatch) {
|
||||||
$r = parseInt(rgbaMatch[1]);
|
$r = parseInt(rgbaMatch[1], 10);
|
||||||
$g = parseInt(rgbaMatch[2]);
|
$g = parseInt(rgbaMatch[2], 10);
|
||||||
$b = parseInt(rgbaMatch[3]);
|
$b = parseInt(rgbaMatch[3], 10);
|
||||||
$a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);
|
$a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);
|
||||||
return channels.toColor($r, $g, $b, $a);
|
return channels.toColor($r, $g, $b, $a);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,19 +21,20 @@
|
|||||||
* http://linux.die.net/man/7/urxvt
|
* http://linux.die.net/man/7/urxvt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, IMouseStateService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from './services/Services';
|
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, IMouseStateService, IUnicodeService, LogLevelEnum, IOscLinkService } from './services/Services';
|
||||||
import { InstantiationService } from './services/InstantiationService';
|
import { InstantiationService } from './services/InstantiationService';
|
||||||
import { LogService } from './services/LogService';
|
import { LogService } from './services/LogService';
|
||||||
import { BufferService, BufferServiceConstants } from './services/BufferService';
|
import { BufferService, BufferServiceConstants } from './services/BufferService';
|
||||||
import { OptionsService } from './services/OptionsService';
|
import { OptionsService } from './services/OptionsService';
|
||||||
import { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from './Types';
|
import { IDisposable, IScrollEvent, ITerminalOptions, IParams } from './Types';
|
||||||
|
import { IAttributeData, IBufferSet } from './buffer/Types';
|
||||||
import { CoreService } from './services/CoreService';
|
import { CoreService } from './services/CoreService';
|
||||||
import { MouseStateService } from './services/MouseStateService';
|
import { MouseStateService } from './services/MouseStateService';
|
||||||
|
import { UnicodeV6 } from './input/UnicodeV6';
|
||||||
import { UnicodeService } from './services/UnicodeService';
|
import { UnicodeService } from './services/UnicodeService';
|
||||||
import { CharsetService } from './services/CharsetService';
|
import { CharsetService } from './services/CharsetService';
|
||||||
import { updateWindowsModeWrappedState } from './WindowsMode';
|
import { updateWindowsModeWrappedState } from './WindowsMode';
|
||||||
import { IFunctionIdentifier, IParams } from './parser/Types';
|
import { IFunctionIdentifier } from './parser/Types';
|
||||||
import { IBufferSet } from './buffer/Types';
|
|
||||||
import { InputHandler } from './InputHandler';
|
import { InputHandler } from './InputHandler';
|
||||||
import { WriteBuffer } from './input/WriteBuffer';
|
import { WriteBuffer } from './input/WriteBuffer';
|
||||||
import { OscLinkService } from './services/OscLinkService';
|
import { OscLinkService } from './services/OscLinkService';
|
||||||
@@ -43,6 +44,20 @@ import { Disposable, MutableDisposable, toDisposable } from './Lifecycle';
|
|||||||
// Only trigger this warning a single time per session
|
// Only trigger this warning a single time per session
|
||||||
let hasWriteSyncWarnHappened = false;
|
let hasWriteSyncWarnHappened = false;
|
||||||
|
|
||||||
|
export interface ICoreTerminal {
|
||||||
|
mouseStateService: IMouseStateService;
|
||||||
|
coreService: ICoreService;
|
||||||
|
optionsService: IOptionsService;
|
||||||
|
unicodeService: IUnicodeService;
|
||||||
|
buffers: IBufferSet;
|
||||||
|
options: Required<ITerminalOptions>;
|
||||||
|
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
|
||||||
|
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
||||||
|
}
|
||||||
|
|
||||||
export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
||||||
protected readonly _instantiationService: IInstantiationService;
|
protected readonly _instantiationService: IInstantiationService;
|
||||||
protected readonly _bufferService: IBufferService;
|
protected readonly _bufferService: IBufferService;
|
||||||
@@ -116,6 +131,7 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
|
|||||||
this.mouseStateService = this._register(this._instantiationService.createInstance(MouseStateService));
|
this.mouseStateService = this._register(this._instantiationService.createInstance(MouseStateService));
|
||||||
this._instantiationService.setService(IMouseStateService, this.mouseStateService);
|
this._instantiationService.setService(IMouseStateService, this.mouseStateService);
|
||||||
this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));
|
this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));
|
||||||
|
this.unicodeService.register(new UnicodeV6());
|
||||||
this._instantiationService.setService(IUnicodeService, this.unicodeService);
|
this._instantiationService.setService(IUnicodeService, this.unicodeService);
|
||||||
this._charsetService = this._instantiationService.createInstance(CharsetService);
|
this._charsetService = this._instantiationService.createInstance(CharsetService);
|
||||||
this._instantiationService.setService(ICharsetService, this._charsetService);
|
this._instantiationService.setService(ICharsetService, this._charsetService);
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { InputHandler } from './InputHandler';
|
import { InputHandler } from './InputHandler';
|
||||||
import { IBufferLine, IAttributeData, IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
|
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
|
||||||
|
import { IAttributeData, IBufferLine } from './buffer/Types';
|
||||||
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
|
||||||
import { CellData } from './buffer/CellData';
|
import { CellData } from './buffer/CellData';
|
||||||
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
|
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
|
import { IInputHandler, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
|
||||||
|
import { IAttributeData, IBuffer } from './buffer/Types';
|
||||||
import { C0, C1 } from './data/EscapeSequences';
|
import { C0, C1 } from './data/EscapeSequences';
|
||||||
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
|
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
|
||||||
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
|
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
|
||||||
@@ -20,7 +21,6 @@ import { UnicodeService } from './services/UnicodeService';
|
|||||||
import { OscHandler } from './parser/OscParser';
|
import { OscHandler } from './parser/OscParser';
|
||||||
import { DcsHandler } from './parser/DcsParser';
|
import { DcsHandler } from './parser/DcsParser';
|
||||||
import { ApcHandler } from './parser/ApcParser';
|
import { ApcHandler } from './parser/ApcParser';
|
||||||
import { IBuffer } from './buffer/Types';
|
|
||||||
import { parseColor } from './input/XParseColor';
|
import { parseColor } from './input/XParseColor';
|
||||||
import { Emitter } from './Event';
|
import { Emitter } from './Event';
|
||||||
import { XTERM_VERSION } from './Version';
|
import { XTERM_VERSION } from './Version';
|
||||||
@@ -3065,7 +3065,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const idx = slots.shift() as string;
|
const idx = slots.shift() as string;
|
||||||
const spec = slots.shift() as string;
|
const spec = slots.shift() as string;
|
||||||
if (/^\d+$/.exec(idx)) {
|
if (/^\d+$/.exec(idx)) {
|
||||||
const index = parseInt(idx);
|
const index = parseInt(idx, 10);
|
||||||
if (isValidColorIndex(index)) {
|
if (isValidColorIndex(index)) {
|
||||||
if (spec === '?') {
|
if (spec === '?') {
|
||||||
event.push({ type: ColorRequestType.REPORT, index });
|
event.push({ type: ColorRequestType.REPORT, index });
|
||||||
@@ -3228,7 +3228,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const slots = data.split(';');
|
const slots = data.split(';');
|
||||||
for (let i = 0; i < slots.length; ++i) {
|
for (let i = 0; i < slots.length; ++i) {
|
||||||
if (/^\d+$/.exec(slots[i])) {
|
if (/^\d+$/.exec(slots[i])) {
|
||||||
const index = parseInt(slots[i]);
|
const index = parseInt(slots[i], 10);
|
||||||
if (isValidColorIndex(index)) {
|
if (isValidColorIndex(index)) {
|
||||||
event.push({ type: ColorRequestType.RESTORE, index });
|
event.push({ type: ColorRequestType.RESTORE, index });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export function getSafariVersion(): number {
|
|||||||
if (majorVersion === null || majorVersion.length < 2) {
|
if (majorVersion === null || majorVersion.length < 2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return parseInt(majorVersion[1]);
|
return parseInt(majorVersion[1], 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the users platform. We use this to interpret the meta key
|
// Find the users platform. We use this to interpret the meta key
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, IMouseStateService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService, type IBufferResizeEvent } from './services/Services';
|
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, IMouseStateService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService, type IBufferResizeEvent } from './services/Services';
|
||||||
import { UnicodeService } from './services/UnicodeService';
|
import { UnicodeService } from './services/UnicodeService';
|
||||||
import { DEFAULT_OPTIONS } from './services/OptionsService';
|
import { DEFAULT_OPTIONS } from './services/OptionsService';
|
||||||
import { IBufferSet, IBuffer } from './buffer/Types';
|
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './buffer/Types';
|
||||||
import { BufferSet } from './buffer/BufferSet';
|
import { BufferSet } from './buffer/BufferSet';
|
||||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable, IBufferLine, IExtendedAttrs } from './Types';
|
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IOscLinkData, IDisposable } from './Types';
|
||||||
import { UnicodeV6 } from './input/UnicodeV6';
|
import { UnicodeV6 } from './input/UnicodeV6';
|
||||||
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
|
||||||
import { Emitter, type IEvent } from './Event';
|
import { Emitter, type IEvent } from './Event';
|
||||||
|
|||||||
+24
-182
@@ -3,26 +3,32 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDeleteEvent, IInsertEvent } from './CircularList';
|
|
||||||
import { UnderlineStyle } from './buffer/Constants';
|
|
||||||
import { IBufferSet } from './buffer/Types';
|
|
||||||
import { IParams } from './parser/Types';
|
|
||||||
import { IMouseStateService, ICoreService, IOptionsService, IUnicodeService } from './services/Services';
|
|
||||||
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
|
||||||
import type { Emitter, IEvent } from './Event';
|
import type { IEvent } from './Event';
|
||||||
|
|
||||||
export interface ICoreTerminal {
|
/** sequence params serialized to js arrays */
|
||||||
mouseStateService: IMouseStateService;
|
export type ParamsArray = (number | number[])[];
|
||||||
coreService: ICoreService;
|
|
||||||
optionsService: IOptionsService;
|
/** Interface of Params storage class. */
|
||||||
unicodeService: IUnicodeService;
|
export interface IParams {
|
||||||
buffers: IBufferSet;
|
/** from ctor */
|
||||||
options: Required<ITerminalOptions>;
|
maxLength: number;
|
||||||
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
|
maxSubParamsLength: number;
|
||||||
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
|
|
||||||
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
|
/** param values and its length */
|
||||||
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
params: Int32Array;
|
||||||
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
|
length: number;
|
||||||
|
|
||||||
|
/** methods */
|
||||||
|
clone(): IParams;
|
||||||
|
toArray(): ParamsArray;
|
||||||
|
reset(): void;
|
||||||
|
resetZdm(): void;
|
||||||
|
addParam(value: number): void;
|
||||||
|
addSubParam(value: number): void;
|
||||||
|
hasSubParams(idx: number): boolean;
|
||||||
|
getSubParams(idx: number): Int32Array | null;
|
||||||
|
getSubParamsAll(): {[idx: number]: Int32Array};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDisposable {
|
export interface IDisposable {
|
||||||
@@ -62,28 +68,6 @@ export interface IScrollEvent {
|
|||||||
position: number;
|
position: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICircularList<T> {
|
|
||||||
length: number;
|
|
||||||
maxLength: number;
|
|
||||||
isFull: boolean;
|
|
||||||
|
|
||||||
onDeleteEmitter: Emitter<IDeleteEvent>;
|
|
||||||
onDelete: IEvent<IDeleteEvent>;
|
|
||||||
onInsertEmitter: Emitter<IInsertEvent>;
|
|
||||||
onInsert: IEvent<IInsertEvent>;
|
|
||||||
onTrimEmitter: Emitter<number>;
|
|
||||||
onTrim: IEvent<number>;
|
|
||||||
|
|
||||||
get(index: number): T | undefined;
|
|
||||||
set(index: number, value: T): void;
|
|
||||||
push(value: T): void;
|
|
||||||
recycle(): T;
|
|
||||||
pop(): T | undefined;
|
|
||||||
splice(start: number, deleteCount: number, ...items: T[]): void;
|
|
||||||
trimStart(count: number): void;
|
|
||||||
shiftElements(start: number, count: number, offset: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const enum KeyboardResultType {
|
export const enum KeyboardResultType {
|
||||||
SEND_KEY,
|
SEND_KEY,
|
||||||
SELECT_ALL,
|
SELECT_ALL,
|
||||||
@@ -101,24 +85,12 @@ export interface ICharset {
|
|||||||
[key: string]: string | undefined;
|
[key: string]: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CharData = [attr: number, char: string, width: number, code: number];
|
|
||||||
|
|
||||||
export interface IColor {
|
export interface IColor {
|
||||||
readonly css: string;
|
readonly css: string;
|
||||||
readonly rgba: number; // 32-bit int with rgba in each byte
|
readonly rgba: number; // 32-bit int with rgba in each byte
|
||||||
}
|
}
|
||||||
export type IColorRGB = [red: number, green: number, blue: number];
|
export type IColorRGB = [red: number, green: number, blue: number];
|
||||||
|
|
||||||
export interface IExtendedAttrs {
|
|
||||||
ext: number;
|
|
||||||
underlineStyle: UnderlineStyle;
|
|
||||||
underlineColor: number;
|
|
||||||
underlineVariantOffset: number;
|
|
||||||
urlId: number;
|
|
||||||
clone(): IExtendedAttrs;
|
|
||||||
isEmpty(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
|
* Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
|
||||||
* to the linkifier when anything is printed. Doing it this way ensures that even when the cursor
|
* to the linkifier when anything is printed. Doing it this way ensures that even when the cursor
|
||||||
@@ -130,136 +102,6 @@ export interface IOscLinkData {
|
|||||||
uri: string;
|
uri: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* An object that represents all attributes of a cell.
|
|
||||||
*/
|
|
||||||
export interface IAttributeData {
|
|
||||||
/**
|
|
||||||
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
|
|
||||||
* significant bits and additional flags in the remaining 8 bits.
|
|
||||||
*/
|
|
||||||
fg: number;
|
|
||||||
/**
|
|
||||||
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
|
|
||||||
* significant bits and additional flags in the remaining 8 bits.
|
|
||||||
*/
|
|
||||||
bg: number;
|
|
||||||
/**
|
|
||||||
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
|
|
||||||
* data is optional on a cell and encodes less common data.
|
|
||||||
*/
|
|
||||||
extended: IExtendedAttrs;
|
|
||||||
|
|
||||||
clone(): IAttributeData;
|
|
||||||
|
|
||||||
// flags
|
|
||||||
isInverse(): number;
|
|
||||||
isBold(): number;
|
|
||||||
isUnderline(): number;
|
|
||||||
isBlink(): number;
|
|
||||||
isInvisible(): number;
|
|
||||||
isItalic(): number;
|
|
||||||
isDim(): number;
|
|
||||||
isStrikethrough(): number;
|
|
||||||
isProtected(): number;
|
|
||||||
isOverline(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color mode of the foreground color which determines how to decode {@link getFgColor},
|
|
||||||
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
|
||||||
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
|
||||||
*/
|
|
||||||
getFgColorMode(): number;
|
|
||||||
/**
|
|
||||||
* The color mode of the background color which determines how to decode {@link getBgColor},
|
|
||||||
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
|
||||||
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
|
||||||
*/
|
|
||||||
getBgColorMode(): number;
|
|
||||||
isFgRGB(): boolean;
|
|
||||||
isBgRGB(): boolean;
|
|
||||||
isFgPalette(): boolean;
|
|
||||||
isBgPalette(): boolean;
|
|
||||||
isFgDefault(): boolean;
|
|
||||||
isBgDefault(): boolean;
|
|
||||||
isAttributeDefault(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an integer representation of the foreground color, how to decode the color depends on the
|
|
||||||
* color mode {@link getFgColorMode}.
|
|
||||||
*/
|
|
||||||
getFgColor(): number;
|
|
||||||
/**
|
|
||||||
* Gets an integer representation of the background color, how to decode the color depends on the
|
|
||||||
* color mode {@link getBgColorMode}.
|
|
||||||
*/
|
|
||||||
getBgColor(): number;
|
|
||||||
|
|
||||||
// extended attrs
|
|
||||||
hasExtendedAttrs(): number;
|
|
||||||
updateExtended(): void;
|
|
||||||
getUnderlineColor(): number;
|
|
||||||
getUnderlineColorMode(): number;
|
|
||||||
isUnderlineColorRGB(): boolean;
|
|
||||||
isUnderlineColorPalette(): boolean;
|
|
||||||
isUnderlineColorDefault(): boolean;
|
|
||||||
getUnderlineStyle(): number;
|
|
||||||
getUnderlineVariantOffset(): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Cell data */
|
|
||||||
export interface ICellData extends IAttributeData {
|
|
||||||
content: number;
|
|
||||||
combinedData: string;
|
|
||||||
isCombined(): number;
|
|
||||||
getWidth(): number;
|
|
||||||
getChars(): string;
|
|
||||||
getCode(): number;
|
|
||||||
setFromCharData(value: CharData): void;
|
|
||||||
getAsCharData(): CharData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for a line in the terminal buffer.
|
|
||||||
*/
|
|
||||||
export interface IBufferLine {
|
|
||||||
length: number;
|
|
||||||
isWrapped: boolean;
|
|
||||||
get(index: number): CharData;
|
|
||||||
set(index: number, value: CharData): void;
|
|
||||||
loadCell(index: number, cell: ICellData): ICellData;
|
|
||||||
setCell(index: number, cell: ICellData): void;
|
|
||||||
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
|
|
||||||
addCodepointToCell(index: number, codePoint: number, width: number): void;
|
|
||||||
insertCells(pos: number, n: number, ch: ICellData): void;
|
|
||||||
deleteCells(pos: number, n: number, fill: ICellData): void;
|
|
||||||
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
|
|
||||||
resize(cols: number, fill: ICellData): boolean;
|
|
||||||
cleanupMemory(): number;
|
|
||||||
fill(fillCellData: ICellData, respectProtect?: boolean): void;
|
|
||||||
copyFrom(line: IBufferLine): void;
|
|
||||||
clone(): IBufferLine;
|
|
||||||
getTrimmedLength(): number;
|
|
||||||
getNoBgTrimmedLength(): number;
|
|
||||||
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
|
|
||||||
|
|
||||||
/* direct access to cell attrs */
|
|
||||||
getWidth(index: number): number;
|
|
||||||
hasWidth(index: number): number;
|
|
||||||
getFg(index: number): number;
|
|
||||||
getBg(index: number): number;
|
|
||||||
hasContent(index: number): number;
|
|
||||||
getCodePoint(index: number): number;
|
|
||||||
isCombined(index: number): number;
|
|
||||||
getString(index: number): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMarker extends IDisposable {
|
|
||||||
readonly id: number;
|
|
||||||
readonly isDisposed: boolean;
|
|
||||||
readonly line: number;
|
|
||||||
onDispose: IEvent<void>;
|
|
||||||
}
|
|
||||||
export interface IModes {
|
export interface IModes {
|
||||||
insertMode: boolean;
|
insertMode: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IAttributeData, IColorRGB, IExtendedAttrs } from '../Types';
|
import { IColorRGB } from '../Types';
|
||||||
|
import { IAttributeData, IExtendedAttrs } from './Types';
|
||||||
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from './Constants';
|
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from './Constants';
|
||||||
|
|
||||||
export class AttributeData implements IAttributeData {
|
export class AttributeData implements IAttributeData {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
import { CircularList, IInsertEvent } from '../CircularList';
|
import { CircularList, IInsertEvent } from '../CircularList';
|
||||||
import { Disposable, toDisposable } from '../Lifecycle';
|
import { Disposable, toDisposable } from '../Lifecycle';
|
||||||
import { IdleTaskQueue } from '../TaskQueue';
|
import { IdleTaskQueue } from '../TaskQueue';
|
||||||
import { IAttributeData, IBufferLine, ICellData, ICharset } from '../Types';
|
import { ICharset } from '../Types';
|
||||||
|
import { IAttributeData, IBuffer, IBufferLine, ICellData } from './Types';
|
||||||
import { ExtendedAttrs } from './AttributeData';
|
import { ExtendedAttrs } from './AttributeData';
|
||||||
import { BufferLine, DEFAULT_ATTR_DATA } from './BufferLine';
|
import { BufferLine, DEFAULT_ATTR_DATA } from './BufferLine';
|
||||||
import { BufferLineStringCache } from './BufferLineStringCache';
|
import { BufferLineStringCache } from './BufferLineStringCache';
|
||||||
@@ -14,7 +15,6 @@ import { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCr
|
|||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from './Constants';
|
import { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from './Constants';
|
||||||
import { Marker } from './Marker';
|
import { Marker } from './Marker';
|
||||||
import { IBuffer } from './Types';
|
|
||||||
import { DEFAULT_CHARSET } from '../data/Charsets';
|
import { DEFAULT_CHARSET } from '../data/Charsets';
|
||||||
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR, Content,
|
|||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine } from './BufferLine';
|
||||||
import { BufferLineStringCache } from './BufferLineStringCache';
|
import { BufferLineStringCache } from './BufferLineStringCache';
|
||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { CharData, IBufferLine, ICellData } from '../Types';
|
import { CharData, IBufferLine, ICellData } from './Types';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { AttributeData } from './AttributeData';
|
import { AttributeData } from './AttributeData';
|
||||||
import { createCellData, NULL_CELL_DATA, extendedAttributes } from '../TestUtils.test';
|
import { createCellData, NULL_CELL_DATA, extendedAttributes } from '../TestUtils.test';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from '../Types';
|
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from './Types';
|
||||||
import { AttributeData } from './AttributeData';
|
import { AttributeData } from './AttributeData';
|
||||||
import { CellData } from './CellData';
|
import { CellData } from './CellData';
|
||||||
import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from './Constants';
|
import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from './Constants';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine } from './BufferLine';
|
||||||
import { CircularList } from '../CircularList';
|
import { CircularList } from '../CircularList';
|
||||||
import { IBufferLine, ICellData } from '../Types';
|
import { IBufferLine, ICellData } from './Types';
|
||||||
|
|
||||||
export interface INewLayoutResult {
|
export interface INewLayoutResult {
|
||||||
layout: number[];
|
layout: number[];
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Disposable, MutableDisposable } from '../Lifecycle';
|
import { Disposable, MutableDisposable } from '../Lifecycle';
|
||||||
import { IAttributeData } from '../Types';
|
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { IBuffer, IBufferSet } from './Types';
|
import { IAttributeData, IBuffer, IBufferSet } from './Types';
|
||||||
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CharData, ICellData, IExtendedAttrs } from '../Types';
|
import { CharData, ICellData, IExtendedAttrs } from './Types';
|
||||||
import { stringFromCodePoint } from '../input/TextDecoder';
|
import { stringFromCodePoint } from '../input/TextDecoder';
|
||||||
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
|
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from './Constants';
|
||||||
import { AttributeData, ExtendedAttrs } from './AttributeData';
|
import { AttributeData, ExtendedAttrs } from './AttributeData';
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable, IMarker } from '../Types';
|
import { dispose, IDisposable } from '../Lifecycle';
|
||||||
|
import { IMarker } from './Types';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
import { dispose } from '../Lifecycle';
|
|
||||||
|
|
||||||
export class Marker implements IMarker {
|
export class Marker implements IMarker {
|
||||||
private static _nextId = 1;
|
private static _nextId = 1;
|
||||||
|
|||||||
+147
-1
@@ -3,12 +3,158 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IAttributeData, ICircularList, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from '../Types';
|
|
||||||
import type { IEvent } from '../Event';
|
import type { IEvent } from '../Event';
|
||||||
|
import type { ICircularList } from '../CircularList';
|
||||||
|
import type { ICharset } from '../Types';
|
||||||
|
import type { IDisposable } from '../Lifecycle';
|
||||||
|
import type { UnderlineStyle } from './Constants';
|
||||||
|
|
||||||
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
|
||||||
export type BufferIndex = [number, number];
|
export type BufferIndex = [number, number];
|
||||||
|
|
||||||
|
export type CharData = [attr: number, char: string, width: number, code: number];
|
||||||
|
|
||||||
|
export interface IExtendedAttrs {
|
||||||
|
ext: number;
|
||||||
|
underlineStyle: UnderlineStyle;
|
||||||
|
underlineColor: number;
|
||||||
|
underlineVariantOffset: number;
|
||||||
|
urlId: number;
|
||||||
|
clone(): IExtendedAttrs;
|
||||||
|
isEmpty(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object that represents all attributes of a cell.
|
||||||
|
*/
|
||||||
|
export interface IAttributeData {
|
||||||
|
/**
|
||||||
|
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
|
||||||
|
* significant bits and additional flags in the remaining 8 bits.
|
||||||
|
*/
|
||||||
|
fg: number;
|
||||||
|
/**
|
||||||
|
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
|
||||||
|
* significant bits and additional flags in the remaining 8 bits.
|
||||||
|
*/
|
||||||
|
bg: number;
|
||||||
|
/**
|
||||||
|
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
|
||||||
|
* data is optional on a cell and encodes less common data.
|
||||||
|
*/
|
||||||
|
extended: IExtendedAttrs;
|
||||||
|
|
||||||
|
clone(): IAttributeData;
|
||||||
|
|
||||||
|
// flags
|
||||||
|
isInverse(): number;
|
||||||
|
isBold(): number;
|
||||||
|
isUnderline(): number;
|
||||||
|
isBlink(): number;
|
||||||
|
isInvisible(): number;
|
||||||
|
isItalic(): number;
|
||||||
|
isDim(): number;
|
||||||
|
isStrikethrough(): number;
|
||||||
|
isProtected(): number;
|
||||||
|
isOverline(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color mode of the foreground color which determines how to decode {@link getFgColor},
|
||||||
|
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
||||||
|
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
||||||
|
*/
|
||||||
|
getFgColorMode(): number;
|
||||||
|
/**
|
||||||
|
* The color mode of the background color which determines how to decode {@link getBgColor},
|
||||||
|
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
|
||||||
|
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
|
||||||
|
*/
|
||||||
|
getBgColorMode(): number;
|
||||||
|
isFgRGB(): boolean;
|
||||||
|
isBgRGB(): boolean;
|
||||||
|
isFgPalette(): boolean;
|
||||||
|
isBgPalette(): boolean;
|
||||||
|
isFgDefault(): boolean;
|
||||||
|
isBgDefault(): boolean;
|
||||||
|
isAttributeDefault(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an integer representation of the foreground color, how to decode the color depends on the
|
||||||
|
* color mode {@link getFgColorMode}.
|
||||||
|
*/
|
||||||
|
getFgColor(): number;
|
||||||
|
/**
|
||||||
|
* Gets an integer representation of the background color, how to decode the color depends on the
|
||||||
|
* color mode {@link getBgColorMode}.
|
||||||
|
*/
|
||||||
|
getBgColor(): number;
|
||||||
|
|
||||||
|
// extended attrs
|
||||||
|
hasExtendedAttrs(): number;
|
||||||
|
updateExtended(): void;
|
||||||
|
getUnderlineColor(): number;
|
||||||
|
getUnderlineColorMode(): number;
|
||||||
|
isUnderlineColorRGB(): boolean;
|
||||||
|
isUnderlineColorPalette(): boolean;
|
||||||
|
isUnderlineColorDefault(): boolean;
|
||||||
|
getUnderlineStyle(): number;
|
||||||
|
getUnderlineVariantOffset(): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cell data */
|
||||||
|
export interface ICellData extends IAttributeData {
|
||||||
|
content: number;
|
||||||
|
combinedData: string;
|
||||||
|
isCombined(): number;
|
||||||
|
getWidth(): number;
|
||||||
|
getChars(): string;
|
||||||
|
getCode(): number;
|
||||||
|
setFromCharData(value: CharData): void;
|
||||||
|
getAsCharData(): CharData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for a line in the terminal buffer.
|
||||||
|
*/
|
||||||
|
export interface IBufferLine {
|
||||||
|
length: number;
|
||||||
|
isWrapped: boolean;
|
||||||
|
get(index: number): CharData;
|
||||||
|
set(index: number, value: CharData): void;
|
||||||
|
loadCell(index: number, cell: ICellData): ICellData;
|
||||||
|
setCell(index: number, cell: ICellData): void;
|
||||||
|
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
|
||||||
|
addCodepointToCell(index: number, codePoint: number, width: number): void;
|
||||||
|
insertCells(pos: number, n: number, ch: ICellData): void;
|
||||||
|
deleteCells(pos: number, n: number, fill: ICellData): void;
|
||||||
|
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
|
||||||
|
resize(cols: number, fill: ICellData): boolean;
|
||||||
|
cleanupMemory(): number;
|
||||||
|
fill(fillCellData: ICellData, respectProtect?: boolean): void;
|
||||||
|
copyFrom(line: IBufferLine): void;
|
||||||
|
clone(): IBufferLine;
|
||||||
|
getTrimmedLength(): number;
|
||||||
|
getNoBgTrimmedLength(): number;
|
||||||
|
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
|
||||||
|
|
||||||
|
/* direct access to cell attrs */
|
||||||
|
getWidth(index: number): number;
|
||||||
|
hasWidth(index: number): number;
|
||||||
|
getFg(index: number): number;
|
||||||
|
getBg(index: number): number;
|
||||||
|
hasContent(index: number): number;
|
||||||
|
getCodePoint(index: number): number;
|
||||||
|
isCombined(index: number): number;
|
||||||
|
getString(index: number): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMarker extends IDisposable {
|
||||||
|
readonly id: number;
|
||||||
|
readonly isDisposed: boolean;
|
||||||
|
readonly line: number;
|
||||||
|
onDispose: IEvent<void>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IBuffer {
|
export interface IBuffer {
|
||||||
readonly lines: ICircularList<IBufferLine>;
|
readonly lines: ICircularList<IBufferLine>;
|
||||||
ydisp: number;
|
ydisp: number;
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ export class UnicodeV6 implements IUnicodeVersionProvider {
|
|||||||
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
|
||||||
let width = this.wcwidth(codepoint);
|
let width = this.wcwidth(codepoint);
|
||||||
let shouldJoin = width === 0 && preceding !== 0;
|
let shouldJoin = width === 0 && preceding !== 0;
|
||||||
|
// HACK: Ideally this file would not depend on the service which uses it
|
||||||
if (shouldJoin) {
|
if (shouldJoin) {
|
||||||
const oldWidth = UnicodeService.extractWidth(preceding);
|
const oldWidth = UnicodeService.extractWidth(preceding);
|
||||||
if (oldWidth === 0) {
|
if (oldWidth === 0) {
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable } from '../Types';
|
import { IDisposable, IParams, ParamsArray } from '../Types';
|
||||||
import { ParserState } from './Constants';
|
import { ParserState } from './Constants';
|
||||||
|
|
||||||
|
export type { IParams, ParamsArray };
|
||||||
/** sequence params serialized to js arrays */
|
|
||||||
export type ParamsArray = (number | number[])[];
|
|
||||||
|
|
||||||
/** Params constructor type. */
|
/** Params constructor type. */
|
||||||
export interface IParamsConstructor {
|
export interface IParamsConstructor {
|
||||||
@@ -18,28 +16,6 @@ export interface IParamsConstructor {
|
|||||||
fromArray(values: ParamsArray): IParams;
|
fromArray(values: ParamsArray): IParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Interface of Params storage class. */
|
|
||||||
export interface IParams {
|
|
||||||
/** from ctor */
|
|
||||||
maxLength: number;
|
|
||||||
maxSubParamsLength: number;
|
|
||||||
|
|
||||||
/** param values and its length */
|
|
||||||
params: Int32Array;
|
|
||||||
length: number;
|
|
||||||
|
|
||||||
/** methods */
|
|
||||||
clone(): IParams;
|
|
||||||
toArray(): ParamsArray;
|
|
||||||
reset(): void;
|
|
||||||
resetZdm(): void;
|
|
||||||
addParam(value: number): void;
|
|
||||||
addSubParam(value: number): void;
|
|
||||||
hasSubParams(idx: number): boolean;
|
|
||||||
getSubParams(idx: number): Int32Array | null;
|
|
||||||
getSubParamsAll(): {[idx: number]: Int32Array};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal state of EscapeSequenceParser.
|
* Internal state of EscapeSequenceParser.
|
||||||
* Used as argument of the error handler to allow
|
* Used as argument of the error handler to allow
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { CellData } from '../buffer/CellData';
|
import { CellData } from '../buffer/CellData';
|
||||||
import { IBufferLine, ICellData } from '../Types';
|
import { IBufferLine, ICellData } from '../buffer/Types';
|
||||||
import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
|
import { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';
|
||||||
|
|
||||||
export class BufferLineApiView implements IBufferLineApi {
|
export class BufferLineApiView implements IBufferLineApi {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
||||||
import { BufferApiView } from './BufferApiView';
|
import { BufferApiView } from './BufferApiView';
|
||||||
import { ICoreTerminal } from '../Types';
|
import { ICoreTerminal } from '../CoreTerminal';
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { IParams } from '../parser/Types';
|
import { IParams } from '../parser/Types';
|
||||||
import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
|
import { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';
|
||||||
import { ICoreTerminal } from '../Types';
|
import { ICoreTerminal } from '../CoreTerminal';
|
||||||
|
|
||||||
export class ParserApi implements IParser {
|
export class ParserApi implements IParser {
|
||||||
constructor(private _core: ICoreTerminal) { }
|
constructor(private _core: ICoreTerminal) { }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICoreTerminal } from '../Types';
|
import { ICoreTerminal } from '../CoreTerminal';
|
||||||
import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
|
import { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';
|
||||||
|
|
||||||
export class UnicodeApi implements IUnicodeHandling {
|
export class UnicodeApi implements IUnicodeHandling {
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { IAttributeData, IBufferLine } from '../Types';
|
import { IAttributeData, IBuffer, IBufferLine, IBufferSet } from '../buffer/Types';
|
||||||
import { BufferSet } from '../buffer/BufferSet';
|
import { BufferSet } from '../buffer/BufferSet';
|
||||||
import { IBuffer, IBufferSet } from '../buffer/Types';
|
|
||||||
import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
|
import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from './Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { DecorationLineCache, DecorationService } from './DecorationService';
|
import { DecorationLineCache, DecorationService } from './DecorationService';
|
||||||
import { IMarker } from '../Types';
|
import { IMarker } from '../buffer/Types';
|
||||||
import { Disposable } from '../Lifecycle';
|
import { Disposable } from '../Lifecycle';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
import { MockLogService, MockBufferService, MockOptionsService } from '../TestUtils.test';
|
import { MockLogService, MockBufferService, MockOptionsService } from '../TestUtils.test';
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IDeleteEvent, IInsertEvent } from '../CircularList';
|
import type { ICircularList, IDeleteEvent, IInsertEvent } from '../CircularList';
|
||||||
import { MicrotaskTimer } from '../Async';
|
import { MicrotaskTimer } from '../Async';
|
||||||
import { css } from '../Color';
|
import { css } from '../Color';
|
||||||
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../Lifecycle';
|
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../Lifecycle';
|
||||||
import { IBufferService, IDecorationService, IInternalDecoration, ILogService } from './Services';
|
import { IBufferService, IDecorationService, IInternalDecoration, ILogService } from './Services';
|
||||||
import { SortedList } from '../SortedList';
|
import { SortedList } from '../SortedList';
|
||||||
import { IColor, ICircularList } from '../Types';
|
import { IColor } from '../Types';
|
||||||
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { IInstantiationService, IServiceIdentifier } from './Services';
|
import { IInstantiationService } from './Services';
|
||||||
import { getServiceDependencies } from './ServiceRegistry';
|
import { IServiceIdentifier, getServiceDependencies } from './ServiceRegistry';
|
||||||
|
|
||||||
export class ServiceCollection {
|
export class ServiceCollection {
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
import { IBufferService, IOscLinkService } from './Services';
|
import { IBufferService, IOscLinkService } from './Services';
|
||||||
import { IMarker, IOscLinkData } from '../Types';
|
import { IOscLinkData } from '../Types';
|
||||||
|
import { IMarker } from '../buffer/Types';
|
||||||
|
|
||||||
export class OscLinkService implements IOscLinkService {
|
export class OscLinkService implements IOscLinkService {
|
||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { IServiceIdentifier } from './Services';
|
export interface IServiceIdentifier<T> {
|
||||||
|
(...args: any[]): void;
|
||||||
|
type: T;
|
||||||
|
_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
const enum Constants {
|
const enum Constants {
|
||||||
DI_TARGET = 'di$target',
|
DI_TARGET = 'di$target',
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
|
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
|
||||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
|
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from '../Types';
|
||||||
import { IBuffer, IBufferSet } from '../buffer/Types';
|
import { IAttributeData, IBuffer, IBufferSet } from '../buffer/Types';
|
||||||
import { createDecorator } from './ServiceRegistry';
|
import { createDecorator, IServiceIdentifier } from './ServiceRegistry';
|
||||||
import type { Emitter, IEvent } from '../Event';
|
import type { Emitter, IEvent } from '../Event';
|
||||||
|
|
||||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||||
@@ -119,12 +119,6 @@ export interface ICharsetService {
|
|||||||
setgCharset(g: number, charset: ICharset | undefined): void;
|
setgCharset(g: number, charset: ICharset | undefined): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IServiceIdentifier<T> {
|
|
||||||
(...args: any[]): void;
|
|
||||||
type: T;
|
|
||||||
_id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBrandedService {
|
export interface IBrandedService {
|
||||||
serviceBrand: undefined;
|
serviceBrand: undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
import { UnicodeV6 } from '../input/UnicodeV6';
|
||||||
import { UnicodeService } from './UnicodeService';
|
import { UnicodeService } from './UnicodeService';
|
||||||
import { IUnicodeVersionProvider } from './Services';
|
import { IUnicodeVersionProvider } from './Services';
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ describe('unicode provider', () => {
|
|||||||
let us: UnicodeService;
|
let us: UnicodeService;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
us = new UnicodeService();
|
us = new UnicodeService();
|
||||||
|
us.register(new UnicodeV6());
|
||||||
});
|
});
|
||||||
it('default to V6', () => {
|
it('default to V6', () => {
|
||||||
assert.equal(us.activeVersion, '6');
|
assert.equal(us.activeVersion, '6');
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { UnicodeV6 } from '../input/UnicodeV6';
|
|
||||||
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from './Services';
|
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from './Services';
|
||||||
import { Emitter } from '../Event';
|
import { Emitter } from '../Event';
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
|
|
||||||
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
|
private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);
|
||||||
private _active: string = '';
|
private _active: string = '';
|
||||||
private _activeProvider: IUnicodeVersionProvider;
|
private _activeProvider!: IUnicodeVersionProvider;
|
||||||
|
|
||||||
private readonly _onChange = new Emitter<string>();
|
private readonly _onChange = new Emitter<string>();
|
||||||
public readonly onChange = this._onChange.event;
|
public readonly onChange = this._onChange.event;
|
||||||
@@ -30,13 +29,6 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
|
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
|
||||||
const defaultProvider = new UnicodeV6();
|
|
||||||
this.register(defaultProvider);
|
|
||||||
this._active = defaultProvider.version;
|
|
||||||
this._activeProvider = defaultProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
this._onChange.dispose();
|
this._onChange.dispose();
|
||||||
}
|
}
|
||||||
@@ -60,6 +52,9 @@ export class UnicodeService implements IUnicodeService {
|
|||||||
|
|
||||||
public register(provider: IUnicodeVersionProvider): void {
|
public register(provider: IUnicodeVersionProvider): void {
|
||||||
this._providers[provider.version] = provider;
|
this._providers[provider.version] = provider;
|
||||||
|
if (!this._active) {
|
||||||
|
this.activeVersion = provider.version;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
|
||||||
import { IBuffer } from '../common/buffer/Types';
|
import { IBuffer, IMarker } from '../common/buffer/Types';
|
||||||
import { CoreTerminal } from '../common/CoreTerminal';
|
import { CoreTerminal } from '../common/CoreTerminal';
|
||||||
import { IMarker, ITerminalOptions } from '../common/Types';
|
import { ITerminalOptions } from '../common/Types';
|
||||||
import { Emitter, EventUtils } from '../common/Event';
|
import { Emitter, EventUtils } from '../common/Event';
|
||||||
|
|
||||||
export class Terminal extends CoreTerminal {
|
export class Terminal extends CoreTerminal {
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import { Browser, JSHandle, Page } from '@playwright/test';
|
|||||||
import { deepStrictEqual, strictEqual } from 'assert';
|
import { deepStrictEqual, strictEqual } from 'assert';
|
||||||
import type { IRenderDimensions as IRenderDimensionsInternal } from '../../src/browser/renderer/shared/Types';
|
import type { IRenderDimensions as IRenderDimensionsInternal } from '../../src/browser/renderer/shared/Types';
|
||||||
import type { IRenderService } from '../../src/browser/services/Services';
|
import type { IRenderService } from '../../src/browser/services/Services';
|
||||||
import type { ICoreTerminal, IDisposable, IMarker } from '../../src/common/Types';
|
import type { IDisposable } from '../../src/common/Types';
|
||||||
|
import type { IMarker } from '../../src/common/buffer/Types';
|
||||||
|
import type { ICoreTerminal } from '../../src/common/CoreTerminal';
|
||||||
import * as playwright from '@playwright/test';
|
import * as playwright from '@playwright/test';
|
||||||
import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, IRenderDimensions, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from '@xterm/xterm';
|
import { IBuffer, IBufferCell, IBufferLine, IBufferNamespace, IBufferRange, IDecoration, IDecorationOptions, IModes, IRenderDimensions, ITerminalInitOnlyOptions, ITerminalOptions, Terminal } from '@xterm/xterm';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user