Compare commits

...
Author SHA1 Message Date
Cursor AgentandDaniel Imms 511ce3f5d3 Remove unused type imports from common/Types.ts
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:43:00 +00:00
Cursor AgentandDaniel Imms cf68f0b514 Restore tsconfig files to match master (undo whitespace-only changes)
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:39:14 +00:00
Cursor AgentandDaniel Imms bd8510e3ab Move primitive types from common/Types.ts to common/primitives/Types.ts
Extract low-level types (IParams, ParamsArray, IDisposable, color,
keyboard, mouse, charset, etc.) into primitives/Types.ts. Keep
runtime/integration types (ITerminalOptions, IInputHandler, terminal
modes) in common/Types.ts. Lifecycle re-exports IDisposable from
primitives/Types.ts.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:32:48 +00:00
Cursor AgentandDaniel Imms f6c1b21258 Revert esbuild.mjs entry point split for primitives folder
src/common/**/*.ts already covers primitives since they remain under
common/. No build configuration changes are needed for this move.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:29:16 +00:00
Cursor AgentandDaniel Imms b7d45bfefa Revert tsconfig path mapping changes for primitives folder
Primitives remain under src/common/, so common/* aliases do not need
a separate primitives entry. Restore original tsconfig paths.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:24:02 +00:00
Cursor AgentandDaniel Imms 701c0affd5 Move common primitives to src/common/primitives/
Phase 1 of #5963: reorganize building blocks (buffer, parser, input,
data, and shared utilities) under common/primitives/. Runtime code
(services, public API, CoreTerminal, InputHandler) stays in place.

Update import paths across browser, headless, addons, and tests.
Add TypeScript path mappings so common/* aliases resolve primitives
first, then the common root.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 18:21:03 +00:00
169 changed files with 534 additions and 523 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
import type { ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ImageAddon as IImageApi } from '@xterm/addon-image';
import { Emitter, type IEvent } from 'common/Event';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { IIPHandler } from './IIPHandler';
import { ImageRenderer } from './ImageRenderer';
import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage';
+1 -1
View File
@@ -6,7 +6,7 @@
import { toRGBA8888 } from 'sixel/lib/Colors';
import { IDisposable } from '@xterm/xterm';
import { ICellSize, ImageLayer, ITerminalExt, IImageSpec, IRenderDimensions, IRenderService } from './Types';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
const enum Constants {
PLACEHOLDER_LENGTH = 4096,
+4 -4
View File
@@ -6,11 +6,11 @@
import { IDisposable, IMarker, Terminal } from '@xterm/xterm';
// private imports from base repo we build against
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
import type { AttributeData } from 'common/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/primitives/buffer/Constants';
import type { AttributeData } from 'common/primitives/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/primitives/parser/Types';
import type { IInputHandler } from 'common/Types';
import type { IBufferLine, IExtendedAttrs } from 'common/buffer/Types';
import type { IBufferLine, IExtendedAttrs } from 'common/primitives/buffer/Types';
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ProgressAddon as IProgressApi, IProgressState } from '@xterm/addon-progress';
import type { Emitter, IEvent } from 'common/Event';
import type { Emitter, IEvent } from 'common/primitives/Event';
const enum ProgressType {
@@ -10,7 +10,7 @@ import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import type { ISearchDecorationOptions } from '@xterm/addon-search';
import type { IDecorationOptions } from '@xterm/xterm';
import { DisposableStore } from 'common/Lifecycle';
import { DisposableStore } from 'common/primitives/Lifecycle';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, IDisposable, IDecoration } from '@xterm/xterm';
import type { ISearchDecorationOptions } from '@xterm/addon-search';
import { dispose, Disposable, toDisposable } from 'common/Lifecycle';
import { dispose, Disposable, toDisposable } from 'common/primitives/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
+3 -3
View File
@@ -5,9 +5,9 @@
import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm';
import type { SearchAddon as ISearchApi, ISearchOptions, ISearchAddonOptions, ISearchResultChangeEvent, ISearchDecorationOptions } from '@xterm/addon-search';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { disposableTimeout } from 'common/primitives/Async';
import { SearchLineCache } from './SearchLineCache';
import { SearchState } from './SearchState';
import { SearchEngine, type ISearchResult } from './SearchEngine';
+1 -1
View File
@@ -7,7 +7,7 @@ import { SearchEngine } from './SearchEngine';
import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import type { ISearchOptions } from '@xterm/addon-search';
import { DisposableStore } from 'common/Lifecycle';
import { DisposableStore } from 'common/primitives/Lifecycle';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { SearchLineCache, LineCacheEntry } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import { timeout } from 'common/Async';
import { timeout } from 'common/primitives/Async';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import type { Terminal } from '@xterm/xterm';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { disposableTimeout } from 'common/primitives/Async';
export type LineCacheEntry = [
/**
@@ -5,8 +5,8 @@
import type { ISearchResultChangeEvent } from '@xterm/addon-search';
import type { IDisposable } from '@xterm/xterm';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable } from 'common/Lifecycle';
import { Emitter, type IEvent } from 'common/primitives/Event';
import { Disposable } from 'common/primitives/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
@@ -6,7 +6,7 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/primitives/input/TextDecoder';
import { Terminal } from 'browser/public/Terminal';
import { SerializeAddon } from 'SerializeAddon';
+3 -3
View File
@@ -7,10 +7,10 @@
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
import { IColor } from 'common/Types';
import { IAttributeData } from 'common/buffer/Types';
import { IColor } from 'common/primitives/Types';
import { IAttributeData } from 'common/primitives/buffer/Types';
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
import { UnderlineStyle } from 'common/buffer/Constants';
import { UnderlineStyle } from 'common/primitives/buffer/Constants';
function constrain(value: number, low: number, high: number): number {
return Math.max(low, Math.min(value, high));
@@ -6,7 +6,7 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/primitives/input/TextDecoder';
import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { UnicodeGraphemeProvider } from 'UnicodeGraphemeProvider';
+3 -3
View File
@@ -1,11 +1,11 @@
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
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/primitives/buffer/Constants';
import { IDecorationService, IOptionsService } from 'common/services/Services';
import { ICellData } from 'common/buffer/Types';
import { ICellData } from 'common/primitives/buffer/Types';
import { Terminal } from '@xterm/xterm';
import { rgba } from 'common/Color';
import { rgba } from 'common/primitives/Color';
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
@@ -6,8 +6,8 @@
import { assert } from 'chai';
import { configEquals } from './CharAtlasUtils';
import { ICharAtlasConfig } from './Types';
import { NULL_COLOR } from 'common/Color';
import { IColor } from 'common/Types';
import { NULL_COLOR } from 'common/primitives/Color';
import { IColor } from 'common/primitives/Types';
function createTestConfig(overrides: Partial<ICharAtlasConfig> = {}): ICharAtlasConfig {
const color: IColor = { css: '#ffffff', rgba: 0xffffffff };
+2 -2
View File
@@ -4,10 +4,10 @@
*/
import { ICharAtlasConfig } from './Types';
import { Attributes } from 'common/buffer/Constants';
import { Attributes } from 'common/primitives/buffer/Constants';
import { ITerminalOptions } from '@xterm/xterm';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { NULL_COLOR } from 'common/Color';
import { NULL_COLOR } from 'common/primitives/Color';
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
// null out some fields that don't matter
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { isFirefox, isLegacyEdge } from 'common/Platform';
import { isFirefox, isLegacyEdge } from 'common/primitives/Platform';
export const DIM_OPACITY = 0.5;
// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge
@@ -3,7 +3,7 @@
* @license MIT
*/
import { toDisposable, IDisposable } from 'common/Lifecycle';
import { toDisposable, IDisposable } from 'common/primitives/Lifecycle';
export function observeDevicePixelDimensions(element: HTMLElement, parentWindow: Window & typeof globalThis, callback: (deviceWidth: number, deviceHeight: number) => void): IDisposable {
// Observe any resizes to the element and extract the actual pixel size of the element if the
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import { TextureAtlas } from './TextureAtlas';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { NULL_CELL_CODE } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { NULL_CELL_CODE } from 'common/primitives/buffer/Constants';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { Terminal } from '@xterm/xterm';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types';
import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils';
+3 -3
View File
@@ -6,9 +6,9 @@
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { Attributes, FgFlags } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { IColor } from 'common/Types';
import { Attributes, FgFlags } from 'common/primitives/buffer/Constants';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { IColor } from 'common/primitives/Types';
import { Terminal } from '@xterm/xterm';
import { RenderModelConstants } from './RenderModel';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
+7 -7
View File
@@ -8,14 +8,14 @@ import { DIM_OPACITY, TEXT_BASELINE } from './Constants';
import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer';
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
import { FourKeyMap } from 'common/MultiKeyMap';
import { IdleTaskQueue } from 'common/TaskQueue';
import { IColor } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
import { NULL_COLOR, channels, color, rgba } from 'common/primitives/Color';
import { FourKeyMap } from 'common/primitives/MultiKeyMap';
import { IdleTaskQueue } from 'common/primitives/TaskQueue';
import { IColor } from 'common/primitives/Types';
import { AttributeData } from 'common/primitives/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/primitives/buffer/Constants';
import { ILogService, IUnicodeService } from 'common/services/Services';
import { Emitter } from 'common/Event';
import { Emitter } from 'common/primitives/Event';
/**
* A shared object which is used to draw nothing for a particular cell.
+2 -2
View File
@@ -6,8 +6,8 @@
import { FontWeight } from '@xterm/xterm';
import { IColorSet } from 'browser/Types';
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
import type { IEvent } from 'common/Event';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/primitives/Types';
import type { IEvent } from 'common/primitives/Event';
export interface IRenderModel {
cells: Uint32Array;
+3 -3
View File
@@ -7,12 +7,12 @@ import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { getSafariVersion, isSafari } from 'common/Platform';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { getSafariVersion, isSafari } from 'common/primitives/Platform';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { IWebGL2RenderingContext } from './Types';
import { WebglRenderer } from './WebglRenderer';
import { Emitter, EventUtils } from 'common/Event';
import { Emitter, EventUtils } from 'common/primitives/Event';
export class WebglAddon extends Disposable implements ITerminalAddon, IWebglApi {
private _terminal?: Terminal;
+6 -6
View File
@@ -10,10 +10,10 @@ import { CursorBlinkStateManager } from './CursorBlinkStateManager';
import { observeDevicePixelDimensions } from './DevicePixelObserver';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { CharData, IBufferLine, ICellData } from 'common/buffer/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
import { CharData, IBufferLine, ICellData } from 'common/primitives/buffer/Types';
import { AttributeData } from 'common/primitives/buffer/AttributeData';
import { CellData } from 'common/primitives/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/primitives/buffer/Constants';
import { TextBlinkStateManager } from 'browser/renderer/shared/TextBlinkStateManager';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
@@ -23,9 +23,9 @@ import { COMBINED_CHAR_BIT_MASK, RenderModel, RenderModelConstants } from './Ren
import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
import { IRenderLayer } from './renderLayer/Types';
import { Emitter, EventUtils } from 'common/Event';
import { Emitter, EventUtils } from 'common/primitives/Event';
import { addDisposableListener } from 'browser/Dom';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/primitives/Lifecycle';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
const enum Constants {
@@ -7,8 +7,8 @@ import { ReadonlyColorSet } from 'browser/Types';
import { acquireTextureAtlas } from '../CharAtlasCache';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { CellData } from 'common/buffer/CellData';
import { Disposable, toDisposable } from 'common/primitives/Lifecycle';
import { CellData } from 'common/primitives/buffer/CellData';
import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { IRenderLayer } from './Types';
@@ -7,7 +7,7 @@ import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
import type { IBufferCell } from '@xterm/xterm';
// Underline style values from common/buffer/Constants.ts
// Underline style values from common/primitives/buffer/Constants.ts
const enum UnderlineStyle {
NONE = 0,
SINGLE = 1,
+2 -2
View File
@@ -6,9 +6,9 @@
import * as Strings from './LocalizableStrings';
import { ITerminal, IRenderDebouncer } from './Types';
import { TimeBasedDebouncer } from './TimeBasedDebouncer';
import { Disposable, toDisposable } from '../common/Lifecycle';
import { Disposable, toDisposable } from '../common/primitives/Lifecycle';
import { ICoreBrowserService, IRenderService } from './services/Services';
import { IBuffer } from '../common/buffer/Types';
import { IBuffer } from '../common/primitives/buffer/Types';
import { IInstantiationService } from '../common/services/Services';
import { addDisposableListener } from './Dom';
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import { IColorContrastCache } from './Types';
import { IColor } from '../common/Types';
import { TwoKeyMap } from '../common/MultiKeyMap';
import { IColor } from '../common/primitives/Types';
import { TwoKeyMap } from '../common/primitives/MultiKeyMap';
export class ColorContrastCache implements IColorContrastCache {
private _color: TwoKeyMap</* bg */number, /* fg */number, IColor | null> = new TwoKeyMap();
+10 -9
View File
@@ -43,22 +43,23 @@ import { SelectionService } from './services/SelectionService';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseCoordsService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
import { ThemeService } from './services/ThemeService';
import { KeyboardService } from './services/KeyboardService';
import { channels, color, rgb } from '../common/Color';
import { channels, color, rgb } from '../common/primitives/Color';
import { CoreTerminal } from '../common/CoreTerminal';
import * as Browser from '../common/Platform';
import { ColorRequestType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from '../common/Types';
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
import { IBuffer } from '../common/buffer/Types';
import { C0, C1ESCAPED } from '../common/data/EscapeSequences';
import { toRgbString } from '../common/input/XParseColor';
import * as Browser from '../common/primitives/Platform';
import { ColorRequestType, IColorEvent, KeyboardResultType, SpecialColorIndex } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { DEFAULT_ATTR_DATA } from '../common/primitives/buffer/BufferLine';
import { IBuffer } from '../common/primitives/buffer/Types';
import { C0, C1ESCAPED } from '../common/primitives/data/EscapeSequences';
import { toRgbString } from '../common/primitives/input/XParseColor';
import { DecorationService } from '../common/services/DecorationService';
import { IDecorationService } from '../common/services/Services';
import { WindowsOptionsReportType } from '../common/InputHandler';
import { AccessibilityManager } from './AccessibilityManager';
import { Linkifier } from './Linkifier';
import { Emitter, EventUtils, type IEvent } from '../common/Event';
import { Emitter, EventUtils, type IEvent } from '../common/primitives/Event';
import { addDisposableListener } from './Dom';
import { MutableDisposable, toDisposable } from '../common/Lifecycle';
import { MutableDisposable, toDisposable } from '../common/primitives/Lifecycle';
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
public textarea: HTMLTextAreaElement | undefined;
+2 -2
View File
@@ -5,8 +5,8 @@
* Minimal DOM helpers for xterm.js browser code.
*/
import { IntervalTimer } from '../common/Async';
import { IDisposable } from '../common/Lifecycle';
import { IntervalTimer } from '../common/primitives/Async';
import { IDisposable } from '../common/primitives/Lifecycle';
export function getWindow(e: Node | UIEvent | undefined | null): Window {
const candidateNode = e as Node | undefined | null;
+3 -3
View File
@@ -4,11 +4,11 @@
*/
import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from './Types';
import { Disposable, dispose, toDisposable } from '../common/Lifecycle';
import { IDisposable } from '../common/Types';
import { Disposable, dispose, toDisposable } from '../common/primitives/Lifecycle';
import { IDisposable } from '../common/primitives/Types';
import { IBufferService } from '../common/services/Services';
import { ILinkProviderService, IMouseCoordsService, IRenderService } from './services/Services';
import { Emitter } from '../common/Event';
import { Emitter } from '../common/primitives/Event';
import { addDisposableListener } from './Dom';
export class Linkifier extends Disposable implements ILinkifier2 {
+2 -2
View File
@@ -8,8 +8,8 @@ import { OscLinkProvider } from './OscLinkProvider';
import { ILink } from './Types';
import { createCellData, MockBufferService, MockOptionsService } from '../common/TestUtils.test';
import { IBufferService, IOscLinkService } from '../common/services/Services';
import { IOscLinkData } from '../common/Types';
import { IBufferLine } from '../common/buffer/Types';
import { IOscLinkData } from '../common/primitives/Types';
import { IBufferLine } from '../common/primitives/buffer/Types';
class TestOscLinkService implements IOscLinkService {
public serviceBrand: any;
+2 -2
View File
@@ -5,8 +5,8 @@
import { IBufferRange, ILink } from './Types';
import { ILinkProvider } from './services/Services';
import { CellData } from '../common/buffer/CellData';
import { IBufferLine } from '../common/buffer/Types';
import { CellData } from '../common/primitives/buffer/CellData';
import { IBufferLine } from '../common/primitives/buffer/Types';
import { IBufferService, IOptionsService, IOscLinkService } from '../common/services/Services';
export class OscLinkProvider implements ILinkProvider {
+3 -3
View File
@@ -6,10 +6,10 @@
import { MockCompositionHelper, MockRenderer, MockViewport, TestTerminal } from './TestUtils.test';
import type { IBrowser } from './Types';
import { assert } from 'chai';
import { DEFAULT_ATTR_DATA } from '../common/buffer/BufferLine';
import { CellData } from '../common/buffer/CellData';
import { DEFAULT_ATTR_DATA } from '../common/primitives/buffer/BufferLine';
import { CellData } from '../common/primitives/buffer/CellData';
import { MockUnicodeService, createCellData } from '../common/TestUtils.test';
import { IMarker } from '../common/buffer/Types';
import { IMarker } from '../common/primitives/buffer/Types';
const INIT_COLS = 80;
const INIT_ROWS = 24;
+10 -9
View File
@@ -7,19 +7,20 @@ import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, I
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from './services/Services';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from './renderer/shared/Types';
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from './Types';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, ICellData } from '../common/buffer/Types';
import { ICircularList } from '../common/CircularList';
import { XtermListener, ICharset, ITerminalOptions, ColorIndex } from '../common/Types';
import { Buffer } from '../common/buffer/Buffer';
import * as Browser from '../common/Platform';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, ICellData } from '../common/primitives/buffer/Types';
import { ICircularList } from '../common/primitives/CircularList';
import { XtermListener, ICharset, ColorIndex } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { Buffer } from '../common/primitives/buffer/Buffer';
import * as Browser from '../common/primitives/Platform';
import { CoreBrowserTerminal } from './CoreBrowserTerminal';
import { IUnicodeService, IOptionsService, ICoreService, IMouseStateService } from '../common/services/Services';
import { IFunctionIdentifier, IParams } from '../common/parser/Types';
import { AttributeData } from '../common/buffer/AttributeData';
import { IFunctionIdentifier, IParams } from '../common/primitives/parser/Types';
import { AttributeData } from '../common/primitives/buffer/AttributeData';
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from './selection/Types';
import { css } from '../common/Color';
import { css } from '../common/primitives/Color';
import { createRenderDimensions } from './renderer/shared/RendererUtils';
import { Emitter, type IEvent } from '../common/Event';
import { Emitter, type IEvent } from '../common/primitives/Event';
export class TestTerminal extends CoreBrowserTerminal {
public get curAttrData(): IAttributeData { return (this as any)._inputHandler._curAttrData; }
+5 -4
View File
@@ -3,12 +3,13 @@
* @license MIT
*/
import { IColor, ITerminalOptions } from '../common/Types';
import { CharData, IBuffer } from '../common/buffer/Types';
import { IColor } from '../common/primitives/Types';
import { ITerminalOptions } from '../common/Types';
import { CharData, IBuffer } from '../common/primitives/buffer/Types';
import { ICoreTerminal } from '../common/CoreTerminal';
import { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';
import { channels, css } from '../common/Color';
import type { IEvent } from '../common/Event';
import { channels, css } from '../common/primitives/Color';
import type { IEvent } from '../common/primitives/Event';
/**
* A portion of the public API that are implemented identially internally and simply passed through.
+3 -3
View File
@@ -5,13 +5,13 @@
import { ICoreBrowserService, IRenderService, IThemeService } from './services/Services';
import { ViewportConstants } from './shared/Constants';
import { Disposable, toDisposable } from '../common/Lifecycle';
import { Disposable, toDisposable } from '../common/primitives/Lifecycle';
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../common/services/Services';
import { CoreMouseEventType } from '../common/Types';
import { CoreMouseEventType } from '../common/primitives/Types';
import { scheduleAtNextAnimationFrame } from './Dom';
import { SmoothScrollableElement } from './scrollable/scrollableElement';
import type { IScrollableElementChangeOptions } from './scrollable/scrollableElementOptions';
import { Emitter, EventUtils } from '../common/Event';
import { Emitter, EventUtils } from '../common/primitives/Event';
import { Scrollable, ScrollbarVisibility, type IScrollEvent } from './scrollable/scrollable';
export class Viewport extends Disposable {
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { ICoreBrowserService, IRenderService } from '../services/Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IBufferService, IDecorationService, IInternalDecoration } from '../../common/services/Services';
export class BufferDecorationRenderer extends Disposable {
@@ -5,7 +5,7 @@
import { ColorZoneStore, IColorZone, IColorZoneStore } from './ColorZoneStore';
import { ICoreBrowserService, IRenderService, IThemeService } from '../services/Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IBufferService, IDecorationService, IOptionsService } from '../../common/services/Services';
const enum Constants {
+1 -1
View File
@@ -5,7 +5,7 @@
import { IRenderService } from '../services/Services';
import { IBufferService, ICoreService, IOptionsService } from '../../common/services/Services';
import { C0 } from '../../common/data/EscapeSequences';
import { C0 } from '../../common/primitives/data/EscapeSequences';
interface IPosition {
start: number;
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { C0 } from '../../common/data/EscapeSequences';
import { C0 } from '../../common/primitives/data/EscapeSequences';
import { IBufferService } from '../../common/services/Services';
const enum Direction {
+2 -2
View File
@@ -6,14 +6,14 @@
import * as Strings from '../LocalizableStrings';
import { CoreBrowserTerminal as TerminalCore } from '../CoreBrowserTerminal';
import { IBufferRange, ITerminal } from '../Types';
import { Disposable } from '../../common/Lifecycle';
import { Disposable } from '../../common/primitives/Lifecycle';
import { ITerminalOptions } from '../../common/Types';
import { AddonManager } from '../../common/public/AddonManager';
import { BufferNamespaceApi } from '../../common/public/BufferNamespaceApi';
import { ParserApi } from '../../common/public/ParserApi';
import { UnicodeApi } from '../../common/public/UnicodeApi';
import { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';
import type { IEvent } from '../../common/Event';
import type { IEvent } from '../../common/primitives/Event';
/**
* The set of options that only have an effect when set in the Terminal constructor.
+3 -3
View File
@@ -12,10 +12,10 @@ import { TextBlinkStateManager } from '../shared/TextBlinkStateManager';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from '../shared/Types';
import { ICharSizeService, ICoreBrowserService, IThemeService } from '../../services/Services';
import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from '../../Types';
import { color } from '../../../common/Color';
import { Disposable, toDisposable } from '../../../common/Lifecycle';
import { color } from '../../../common/primitives/Color';
import { Disposable, toDisposable } from '../../../common/primitives/Lifecycle';
import { IBufferService, ICoreService, IInstantiationService, IOptionsService } from '../../../common/services/Services';
import { Emitter } from '../../../common/Event';
import { Emitter } from '../../../common/primitives/Event';
import { addDisposableListener } from '../../Dom';
@@ -6,11 +6,11 @@
import jsdom = require('jsdom');
import { assert } from 'chai';
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 { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../../common/buffer/BufferLineStringCache';
import { IBufferLine } from '../../../common/buffer/Types';
import { CellData } from '../../../common/buffer/CellData';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from '../../../common/primitives/buffer/Constants';
import { BufferLine, DEFAULT_ATTR_DATA } from '../../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../../common/primitives/buffer/BufferLineStringCache';
import { IBufferLine } from '../../../common/primitives/buffer/Types';
import { CellData } from '../../../common/primitives/buffer/CellData';
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from '../../../common/TestUtils.test';
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from '../../TestUtils.test';
import { TestWidthCache } from './WidthCache.test';
@@ -3,17 +3,17 @@
* @license MIT
*/
import { IColor } from '../../../common/Types';
import { IBufferLine, ICellData } from '../../../common/buffer/Types';
import { IColor } from '../../../common/primitives/Types';
import { IBufferLine, ICellData } from '../../../common/primitives/buffer/Types';
import { INVERTED_DEFAULT_COLOR } from '../shared/Constants';
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/buffer/Constants';
import { CellData } from '../../../common/buffer/CellData';
import { WHITESPACE_CELL_CHAR, Attributes } from '../../../common/primitives/buffer/Constants';
import { CellData } from '../../../common/primitives/buffer/CellData';
import { ICoreService, IDecorationService, IOptionsService } from '../../../common/services/Services';
import { channels, color } from '../../../common/Color';
import { channels, color } from '../../../common/primitives/Color';
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from '../../services/Services';
import { JoinedCellData } from '../../services/CharacterJoinerService';
import { treatGlyphAsBackgroundColor } from '../shared/RendererUtils';
import { AttributeData } from '../../../common/buffer/AttributeData';
import { AttributeData } from '../../../common/primitives/buffer/AttributeData';
import { WidthCache } from './WidthCache';
import { IColorContrastCache } from '../../Types';
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { throwIfFalsy } from '../shared/RendererUtils';
import { IDisposable } from '../../../common/Types';
import { IDisposable } from '../../../common/primitives/Types';
import { FontWeight } from '../../../common/services/Services';
@@ -7,7 +7,7 @@ import { assert } from 'chai';
import { TextBlinkStateManager } from './TextBlinkStateManager';
import { MockOptionsService } from '../../../common/TestUtils.test';
import type { ICoreBrowserService } from '../../services/Services';
import { Emitter } from '../../../common/Event';
import { Emitter } from '../../../common/primitives/Event';
class FakeWindow {
public nextId = 1;
@@ -4,7 +4,7 @@
*/
import { ICoreBrowserService } from '../../services/Services';
import { Disposable, toDisposable } from '../../../common/Lifecycle';
import { Disposable, toDisposable } from '../../../common/primitives/Lifecycle';
import { IOptionsService } from '../../../common/services/Services';
export class TextBlinkStateManager extends Disposable {
+2 -2
View File
@@ -5,8 +5,8 @@
import { Terminal } from '@xterm/xterm';
import { ITerminal } from '../../Types';
import { IDisposable } from '../../../common/Types';
import type { IEvent } from '../../../common/Event';
import { IDisposable } from '../../../common/primitives/Types';
import type { IEvent } from '../../../common/primitives/Event';
export interface IDimensions {
width: number;
+1 -1
View File
@@ -11,7 +11,7 @@ import { ScrollbarArrow, IScrollbarArrowOptions } from './scrollbarArrow';
import { ScrollbarState } from './scrollbarState';
import { ScrollbarVisibilityController } from './scrollbarVisibilityController';
import { Widget } from './widget';
import * as platform from '../../common/Platform';
import * as platform from '../../common/primitives/Platform';
import { INewScrollPosition, Scrollable, ScrollbarVisibility } from './scrollable';
/**
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as dom from '../Dom';
import { DisposableStore, IDisposable, toDisposable } from '../../common/Lifecycle';
import { DisposableStore, IDisposable, toDisposable } from '../../common/primitives/Lifecycle';
type PointerMoveCallback = (event: PointerEvent) => void;
type OnStopCallback = () => void;
+1 -1
View File
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as platform from '../../common/Platform';
import * as platform from '../../common/primitives/Platform';
interface IWindowChainElement {
readonly window: WeakRef<Window>;
+2 -2
View File
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter, IEvent } from '../../common/Event';
import { Disposable, IDisposable } from '../../common/Lifecycle';
import { Emitter, IEvent } from '../../common/primitives/Event';
import { Disposable, IDisposable } from '../../common/primitives/Lifecycle';
export const enum ScrollbarVisibility {
AUTO = 1,
+4 -4
View File
@@ -11,10 +11,10 @@ import { HorizontalScrollbar } from './horizontalScrollbar';
import { IScrollableElementChangeOptions, IScrollableElementCreationOptions, IScrollableElementResolvedOptions } from './scrollableElementOptions';
import { VerticalScrollbar } from './verticalScrollbar';
import { Widget } from './widget';
import { TimeoutTimer } from '../../common/Async';
import { Emitter, IEvent } from '../../common/Event';
import { IDisposable, dispose } from '../../common/Lifecycle';
import * as platform from '../../common/Platform';
import { TimeoutTimer } from '../../common/primitives/Async';
import { Emitter, IEvent } from '../../common/primitives/Event';
import { IDisposable, dispose } from '../../common/primitives/Lifecycle';
import * as platform from '../../common/primitives/Platform';
import { INewScrollDimensions, INewScrollPosition, IScrollDimensions, IScrollPosition, IScrollEvent, Scrollable, ScrollbarVisibility } from './scrollable';
// import 'vs/css!./media/scrollbars';
+1 -1
View File
@@ -5,7 +5,7 @@
import { GlobalPointerMoveMonitor } from './globalPointerMoveMonitor';
import { Widget } from './widget';
import { TimeoutTimer } from '../../common/Async';
import { TimeoutTimer } from '../../common/primitives/Async';
import * as dom from '../Dom';
export interface IScrollbarArrowOptions {
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { FastDomNode } from './fastDomNode';
import { TimeoutTimer } from '../../common/Async';
import { Disposable } from '../../common/Lifecycle';
import { TimeoutTimer } from '../../common/primitives/Async';
import { Disposable } from '../../common/primitives/Lifecycle';
import { ScrollbarVisibility } from './scrollable';
export class ScrollbarVisibilityController extends Disposable {
+1 -1
View File
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as DomUtils from '../Dom';
import { Disposable, IDisposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, IDisposable, toDisposable } from '../../common/primitives/Lifecycle';
const mainWindow = (typeof window === 'object' ? window : globalThis) as Window & typeof globalThis;
+1 -1
View File
@@ -5,7 +5,7 @@
import * as dom from '../Dom';
import { IMouseEvent, StandardMouseEvent } from './mouseEvent';
import { Disposable } from '../../common/Lifecycle';
import { Disposable } from '../../common/primitives/Lifecycle';
export abstract class Widget extends Disposable {
+2 -2
View File
@@ -5,8 +5,8 @@
import { IOptionsService } from '../../common/services/Services';
import { ICharSizeService } from './Services';
import { Disposable } from '../../common/Lifecycle';
import { Emitter } from '../../common/Event';
import { Disposable } from '../../common/primitives/Lifecycle';
import { Emitter } from '../../common/primitives/Event';
export class CharSizeService extends Disposable implements ICharSizeService {
public serviceBrand: undefined;
@@ -6,10 +6,10 @@
import { assert } from 'chai';
import { ICharacterJoinerService } from './Services';
import { CharacterJoinerService } from './CharacterJoinerService';
import { BufferLine } from '../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
import { IBufferLine } from '../../common/buffer/Types';
import { CellData } from '../../common/buffer/CellData';
import { BufferLine } from '../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/primitives/buffer/BufferLineStringCache';
import { IBufferLine } from '../../common/primitives/buffer/Types';
import { CellData } from '../../common/primitives/buffer/CellData';
import { MockBufferService, createCellData } from '../../common/TestUtils.test';
const TEST_STRING_CACHE = new BufferLineStringCache();
@@ -3,11 +3,11 @@
* @license MIT
*/
import { CharData, IBufferLine, ICellData } from '../../common/buffer/Types';
import { CharData, IBufferLine, ICellData } from '../../common/primitives/buffer/Types';
import { ICharacterJoiner } from '../Types';
import { AttributeData } from '../../common/buffer/AttributeData';
import { WHITESPACE_CELL_CHAR, Content } from '../../common/buffer/Constants';
import { CellData } from '../../common/buffer/CellData';
import { AttributeData } from '../../common/primitives/buffer/AttributeData';
import { WHITESPACE_CELL_CHAR, Content } from '../../common/primitives/buffer/Constants';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IBufferService } from '../../common/services/Services';
import { ICharacterJoinerService } from './Services';
+2 -2
View File
@@ -4,9 +4,9 @@
*/
import { ICoreBrowserService } from './Services';
import { Emitter, EventUtils } from '../../common/Event';
import { Emitter, EventUtils } from '../../common/primitives/Event';
import { addDisposableListener } from '../Dom';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
export class CoreBrowserService extends Disposable implements ICoreBrowserService {
public serviceBrand: undefined;
+5 -5
View File
@@ -4,12 +4,12 @@
*/
import { IKeyboardService } from './Services';
import { evaluateKeyboardEvent } from '../../common/input/Keyboard';
import { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from '../../common/input/KittyKeyboard';
import { Win32InputMode } from '../../common/input/Win32InputMode';
import { isMac } from '../../common/Platform';
import { evaluateKeyboardEvent } from '../../common/primitives/input/Keyboard';
import { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from '../../common/primitives/input/KittyKeyboard';
import { Win32InputMode } from '../../common/primitives/input/Win32InputMode';
import { isMac } from '../../common/primitives/Platform';
import { ICoreService, IOptionsService } from '../../common/services/Services';
import { IKeyboardResult } from '../../common/Types';
import { IKeyboardResult } from '../../common/primitives/Types';
export class KeyboardService implements IKeyboardService {
public serviceBrand: undefined;
+2 -2
View File
@@ -1,6 +1,6 @@
import { ILinkProvider, ILinkProviderService } from './Services';
import { Disposable, toDisposable } from '../../common/Lifecycle';
import { IDisposable } from '../../common/Types';
import { Disposable, toDisposable } from '../../common/primitives/Lifecycle';
import { IDisposable } from '../../common/primitives/Types';
export class LinkProviderService extends Disposable implements ILinkProviderService {
declare public serviceBrand: undefined;
+1 -1
View File
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { AltMouseCursorController, MouseEventCssClasses, MouseService } from './MouseService';
import { MouseStateService } from '../../common/services/MouseStateService';
import { CoreMouseAction, CoreMouseButton } from '../../common/Types';
import { CoreMouseAction, CoreMouseButton } from '../../common/primitives/Types';
import { IBufferService, ICoreService, ILogService, IOptionsService } from '../../common/services/Services';
import { OptionsService } from '../../common/services/OptionsService';
import { MockCoreBrowserService, MockRenderService, MockSelectionService } from '../TestUtils.test';
+3 -3
View File
@@ -5,9 +5,9 @@
import { addDisposableListener } from '../Dom';
import { IBufferService, IMouseStateService, ICoreService, ILogService, IOptionsService } from '../../common/services/Services';
import { CoreMouseAction, CoreMouseButton, CoreMouseEventType, ICoreMouseEvent, IDisposable } from '../../common/Types';
import { C0 } from '../../common/data/EscapeSequences';
import { DisposableStore, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { CoreMouseAction, CoreMouseButton, CoreMouseEventType, ICoreMouseEvent, IDisposable } from '../../common/primitives/Types';
import { C0 } from '../../common/primitives/data/EscapeSequences';
import { DisposableStore, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import { ICoreBrowserService, IMouseCoordsService, IMouseService, IMouseServiceTarget, IRenderService, ISelectionService } from './Services';
import { Gesture, EventType as GestureEventType, IGestureEvent } from '../scrollable/touch';
+3 -3
View File
@@ -7,10 +7,10 @@ import { RenderDebouncer } from '../RenderDebouncer';
import { IRenderDebouncerWithCallback } from '../Types';
import { IRenderDimensions, IRenderer } from '../renderer/shared/Types';
import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from './Services';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import { DebouncedIdleTask } from '../../common/TaskQueue';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import { DebouncedIdleTask } from '../../common/primitives/TaskQueue';
import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService } from '../../common/services/Services';
import { Emitter } from '../../common/Event';
import { Emitter } from '../../common/primitives/Event';
interface ISelectionState {
start: [number, number] | undefined;
@@ -6,13 +6,13 @@
import { assert } from 'chai';
import { SelectionService, SelectionMode } from './SelectionService';
import { SelectionModel } from '../selection/SelectionModel';
import { IBuffer, IBufferLine } from '../../common/buffer/Types';
import { IBuffer, IBufferLine } from '../../common/primitives/buffer/Types';
import { MockBufferService, MockOptionsService, MockCoreService, MockMouseStateService, createCellData } from '../../common/TestUtils.test';
import { BufferLine } from '../../common/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/buffer/BufferLineStringCache';
import { BufferLine } from '../../common/primitives/buffer/BufferLine';
import { BufferLineStringCache } from '../../common/primitives/buffer/BufferLineStringCache';
import { IBufferService, IOptionsService } from '../../common/services/Services';
import { MockCoreBrowserService, MockMouseService, MockRenderService } from '../TestUtils.test';
import { CellData } from '../../common/buffer/CellData';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IRenderService } from './Services';
const TEST_STRING_CACHE = new BufferLineStringCache();
+7 -7
View File
@@ -9,14 +9,14 @@ import { moveToCellSequence } from '../input/MoveToCell';
import { SelectionModel } from '../selection/SelectionModel';
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from '../selection/Types';
import { ICoreBrowserService, IMouseCoordsService, IRenderService, ISelectionService } from './Services';
import { Disposable, MutableDisposable, toDisposable } from '../../common/Lifecycle';
import * as Browser from '../../common/Platform';
import { IDisposable } from '../../common/Types';
import { IBuffer, IBufferLine, ICellData } from '../../common/buffer/Types';
import { getRangeLength } from '../../common/buffer/BufferRange';
import { CellData } from '../../common/buffer/CellData';
import { Disposable, MutableDisposable, toDisposable } from '../../common/primitives/Lifecycle';
import * as Browser from '../../common/primitives/Platform';
import { IDisposable } from '../../common/primitives/Types';
import { IBuffer, IBufferLine, ICellData } from '../../common/primitives/buffer/Types';
import { getRangeLength } from '../../common/primitives/buffer/BufferRange';
import { CellData } from '../../common/primitives/buffer/CellData';
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from '../../common/services/Services';
import { Emitter } from '../../common/Event';
import { Emitter } from '../../common/primitives/Event';
const enum Constants {
/**
+2 -2
View File
@@ -7,8 +7,8 @@ import { IRenderDimensions, IRenderer } from '../renderer/shared/Types';
import { IColorSet, ILink, ReadonlyColorSet } from '../Types';
import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from '../selection/Types';
import { createDecorator } from '../../common/services/ServiceRegistry';
import { AllColorIndex, IDisposable, IKeyboardResult } from '../../common/Types';
import type { IEvent } from '../../common/Event';
import { AllColorIndex, IDisposable, IKeyboardResult } from '../../common/primitives/Types';
import type { IEvent } from '../../common/primitives/Event';
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
export interface ICharSizeService {
+4 -4
View File
@@ -6,11 +6,11 @@
import { ColorContrastCache } from '../ColorContrastCache';
import { IThemeService } from './Services';
import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from '../Types';
import { color, css, NULL_COLOR } from '../../common/Color';
import { Disposable } from '../../common/Lifecycle';
import { color, css, NULL_COLOR } from '../../common/primitives/Color';
import { Disposable } from '../../common/primitives/Lifecycle';
import { IOptionsService, ITheme } from '../../common/services/Services';
import { AllColorIndex, IColor, SpecialColorIndex } from '../../common/Types';
import { Emitter } from '../../common/Event';
import { AllColorIndex, IColor, SpecialColorIndex } from '../../common/primitives/Types';
import { Emitter } from '../../common/primitives/Event';
interface IRestoreColorSet {
foreground: IColor;
+8 -7
View File
@@ -26,20 +26,21 @@ import { InstantiationService } from './services/InstantiationService';
import { LogService } from './services/LogService';
import { BufferService, BufferServiceConstants } from './services/BufferService';
import { OptionsService } from './services/OptionsService';
import { IDisposable, IScrollEvent, ITerminalOptions, IParams } from './Types';
import { IAttributeData, IBufferSet } from './buffer/Types';
import { IDisposable, IParams } from './primitives/Types';
import { IScrollEvent, ITerminalOptions } from './Types';
import { IAttributeData, IBufferSet } from './primitives/buffer/Types';
import { CoreService } from './services/CoreService';
import { MouseStateService } from './services/MouseStateService';
import { UnicodeV6 } from './input/UnicodeV6';
import { UnicodeV6 } from './primitives/input/UnicodeV6';
import { UnicodeService } from './services/UnicodeService';
import { CharsetService } from './services/CharsetService';
import { updateWindowsModeWrappedState } from './WindowsMode';
import { IFunctionIdentifier } from './parser/Types';
import { IFunctionIdentifier } from './primitives/parser/Types';
import { InputHandler } from './InputHandler';
import { WriteBuffer } from './input/WriteBuffer';
import { WriteBuffer } from './primitives/input/WriteBuffer';
import { OscLinkService } from './services/OscLinkService';
import { Emitter, EventUtils, type IEvent } from './Event';
import { Disposable, MutableDisposable, toDisposable } from './Lifecycle';
import { Emitter, EventUtils, type IEvent } from './primitives/Event';
import { Disposable, MutableDisposable, toDisposable } from './primitives/Lifecycle';
// Only trigger this warning a single time per session
let hasWriteSyncWarnHappened = false;
+8 -8
View File
@@ -5,13 +5,13 @@
import { assert } from 'chai';
import { InputHandler } from './InputHandler';
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './Types';
import { IAttributeData, IBufferLine } from './buffer/Types';
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { CellData } from './buffer/CellData';
import { Attributes, BgFlags, UnderlineStyle } from './buffer/Constants';
import { AttributeData, ExtendedAttrs } from './buffer/AttributeData';
import { Params } from './parser/Params';
import { IColorEvent, ColorRequestType, SpecialColorIndex } from './primitives/Types';
import { IAttributeData, IBufferLine } from './primitives/buffer/Types';
import { DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { CellData } from './primitives/buffer/CellData';
import { Attributes, BgFlags, UnderlineStyle } from './primitives/buffer/Constants';
import { AttributeData, ExtendedAttrs } from './primitives/buffer/AttributeData';
import { Params } from './primitives/parser/Params';
import { MockCoreService, MockBufferService, MockOptionsService, MockLogService, MockMouseStateService, MockCharsetService, MockUnicodeService, MockOscLinkService, extendedAttributes } from './TestUtils.test';
import { IBufferService, ICoreService, type IOscLinkService } from './services/Services';
import { DEFAULT_OPTIONS } from './services/OptionsService';
@@ -19,7 +19,7 @@ import { BufferService } from './services/BufferService';
import { CharsetService } from './services/CharsetService';
import { CoreService } from './services/CoreService';
import { OscLinkService } from './services/OscLinkService';
import { CHARSETS } from './data/Charsets';
import { CHARSETS } from './primitives/data/Charsets';
function getCursor(bufferService: IBufferService): number[] {
+19 -18
View File
@@ -4,26 +4,27 @@
* @license MIT
*/
import { IInputHandler, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from './Types';
import { IAttributeData, IBuffer } from './buffer/Types';
import { C0, C1 } from './data/EscapeSequences';
import { CHARSETS, DEFAULT_CHARSET } from './data/Charsets';
import { EscapeSequenceParser } from './parser/EscapeSequenceParser';
import { Disposable } from './Lifecycle';
import { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from './input/TextDecoder';
import { BufferLine, DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from './parser/Types';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from './buffer/Constants';
import { CellData } from './buffer/CellData';
import { AttributeData } from './buffer/AttributeData';
import { IDisposable, IColorEvent, ColorIndex, ColorRequestType, SpecialColorIndex } from './primitives/Types';
import { IInputHandler, IWindowOptions, IParseStack } from './Types';
import { IAttributeData, IBuffer } from './primitives/buffer/Types';
import { C0, C1 } from './primitives/data/EscapeSequences';
import { CHARSETS, DEFAULT_CHARSET } from './primitives/data/Charsets';
import { EscapeSequenceParser } from './primitives/parser/EscapeSequenceParser';
import { Disposable } from './primitives/Lifecycle';
import { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from './primitives/input/TextDecoder';
import { BufferLine, DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from './primitives/parser/Types';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from './primitives/buffer/Constants';
import { CellData } from './primitives/buffer/CellData';
import { AttributeData } from './primitives/buffer/AttributeData';
import { ICoreService, IBufferService, IOptionsService, ILogService, IMouseStateService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from './services/Services';
import { UnicodeService } from './services/UnicodeService';
import { OscHandler } from './parser/OscParser';
import { DcsHandler } from './parser/DcsParser';
import { ApcHandler } from './parser/ApcParser';
import { parseColor } from './input/XParseColor';
import { Emitter } from './Event';
import { XTERM_VERSION } from './Version';
import { OscHandler } from './primitives/parser/OscParser';
import { DcsHandler } from './primitives/parser/DcsParser';
import { ApcHandler } from './primitives/parser/ApcParser';
import { parseColor } from './primitives/input/XParseColor';
import { Emitter } from './primitives/Event';
import { XTERM_VERSION } from './primitives/Version';
/**
* Map collect to glevel. Used in `selectCharset`.
+8 -7
View File
@@ -6,14 +6,15 @@
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 { DEFAULT_OPTIONS } from './services/OptionsService';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './buffer/Types';
import { BufferSet } from './buffer/BufferSet';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IOscLinkData, IDisposable } from './Types';
import { UnicodeV6 } from './input/UnicodeV6';
import { IAttributeData, IBuffer, IBufferLine, IBufferSet, IExtendedAttrs } from './primitives/buffer/Types';
import { BufferSet } from './primitives/buffer/BufferSet';
import { ICoreMouseEvent, CoreMouseEventType, ICharset, IOscLinkData, IDisposable } from './primitives/Types';
import { IDecPrivateModes, IModes } from './Types';
import { UnicodeV6 } from './primitives/input/UnicodeV6';
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
import { Emitter, type IEvent } from './Event';
import { CellData } from './buffer/CellData';
import { DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH } from './buffer/Constants';
import { Emitter, type IEvent } from './primitives/Event';
import { CellData } from './primitives/buffer/CellData';
import { DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH } from './primitives/buffer/Constants';
export function createCellData(attr: number, char: string, width: number): CellData {
return CellData.fromCharData([attr, char, width, char.length === 0 ? 0 : char.charCodeAt(0)]);
+2 -226
View File
@@ -4,36 +4,8 @@
*/
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
import type { IEvent } from './Event';
/** sequence params serialized to js arrays */
export type ParamsArray = (number | number[])[];
/** 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};
}
export interface IDisposable {
dispose(): void;
}
import type { IEvent } from './primitives/Event';
import type { CursorStyle, IDisposable, IParams } from './primitives/Types';
// TODO: The options that are not in the public API should be reviewed
export interface ITerminalOptions extends IPublicTerminalOptions {
@@ -42,66 +14,10 @@ export interface ITerminalOptions extends IPublicTerminalOptions {
termName?: string;
}
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export type XtermListener = (...args: any[]) => void;
/**
* A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
* this event.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
/** @deprecated See KeyboardEvent.keyCode */
keyCode: number;
key: string;
type: string;
code: string;
}
export interface IScrollEvent {
position: number;
}
export const enum KeyboardResultType {
SEND_KEY,
SELECT_ALL,
PAGE_UP,
PAGE_DOWN
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
export interface ICharset {
[key: string]: string | undefined;
}
export interface IColor {
readonly css: string;
readonly rgba: number; // 32-bit int with rgba in each byte
}
export type IColorRGB = [red: number, green: number, blue: number];
/**
* 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
* moves around unexpectedly the link is tracked, as opposed to using a start position and
* finalizing it at the end.
*/
export interface IOscLinkData {
id?: string;
uri: string;
}
export interface IModes {
insertMode: boolean;
}
@@ -138,110 +54,6 @@ export interface IKittyKeyboardState {
altStack: number[];
}
export interface IRowRange {
start: number;
end: number;
}
/**
* Interface for mouse events in the core.
*/
export const enum CoreMouseButton {
LEFT = 0,
MIDDLE = 1,
RIGHT = 2,
NONE = 3,
WHEEL = 4,
// additional buttons 1..8
// untested!
AUX1 = 8,
AUX2 = 9,
AUX3 = 10,
AUX4 = 11,
AUX5 = 12,
AUX6 = 13,
AUX7 = 14,
AUX8 = 15
}
export const enum CoreMouseAction {
UP = 0, // buttons, wheel
DOWN = 1, // buttons, wheel
LEFT = 2, // wheel only
RIGHT = 3, // wheel only
MOVE = 32 // buttons only
}
export interface ICoreMouseEvent {
/** column (zero based). */
col: number;
/** row (zero based). */
row: number;
/** xy pixel positions. */
x: number;
y: number;
/**
* Button the action occurred. Due to restrictions of the tracking protocols
* it is not possible to report multiple buttons at once.
* Wheel is treated as a button.
* There are invalid combinations of buttons and actions possible
* (like move + wheel), those are silently ignored by the MouseStateService.
*/
button: CoreMouseButton;
action: CoreMouseAction;
/**
* Modifier states.
* Protocols will add/ignore those based on specific restrictions.
*/
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
}
/**
* CoreMouseEventType
* To be reported to the browser component which events a mouse
* protocol wants to be catched and forwarded as an ICoreMouseEvent
* to MouseStateService.
*/
export const enum CoreMouseEventType {
NONE = 0,
/** any mousedown event */
DOWN = 1,
/** any mouseup event */
UP = 2,
/** any mousemove event while a button is held */
DRAG = 4,
/** any mousemove event without a button */
MOVE = 8,
/** any wheel event */
WHEEL = 16
}
/**
* Mouse protocol interface.
* A mouse protocol can be registered and activated at the MouseStateService.
* `events` should contain a list of needed events as a hint for the browser component
* to install/remove the appropriate event handlers.
* `restrict` applies further protocol specific restrictions like not allowed
* modifiers or filtering invalid event types.
*/
export interface ICoreMouseProtocol {
events: CoreMouseEventType;
restrict: (e: ICoreMouseEvent) => boolean;
}
/**
* CoreMouseEncoding
* The tracking encoding can be registered and activated at the MouseStateService.
* If a ICoreMouseEvent passes all procotol restrictions it will be encoded
* with the active encoding and sent out.
* Note: Returning an empty string will supress sending a mouse report,
* which can be used to skip creating falsey reports in limited encodings
* (DEFAULT only supports up to 223 1-based as coord value).
*/
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
/**
* windowOptions
*/
@@ -270,42 +82,6 @@ export interface IWindowOptions {
setWinLines?: boolean;
}
// color events from common, used for OSC 4/10/11/12 and 104/110/111/112
export const enum ColorRequestType {
REPORT = 0,
SET = 1,
RESTORE = 2
}
// IntRange from https://stackoverflow.com/a/39495173
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
? Acc[number]
: Enumerate<N, [...Acc, Acc['length']]>;
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
export type ColorIndex = IntRange<0, 256>; // number from 0 to 255
export type AllColorIndex = ColorIndex | SpecialColorIndex;
export const enum SpecialColorIndex {
FOREGROUND = 256,
BACKGROUND = 257,
CURSOR = 258
}
export interface IColorReportRequest {
type: ColorRequestType.REPORT;
index: AllColorIndex;
}
export interface IColorSetRequest {
type: ColorRequestType.SET;
index: AllColorIndex;
color: IColorRGB;
}
export interface IColorRestoreRequest {
type: ColorRequestType.RESTORE;
index?: AllColorIndex;
}
export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
/**
* Calls the parser and handles actions generated by the parser.
*/
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { DEFAULT_ATTR_DATA } from './buffer/BufferLine';
import { DEFAULT_ATTR_DATA } from './primitives/buffer/BufferLine';
import { updateWindowsModeWrappedState } from './WindowsMode';
import { BufferService } from './services/BufferService';
import { OptionsService } from './services/OptionsService';
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './buffer/Constants';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './primitives/buffer/Constants';
import { IBufferService } from './services/Services';
export function updateWindowsModeWrappedState(bufferService: IBufferService): void {
@@ -6,9 +6,9 @@
* Simplified from VS Code's lifecycle.ts - no tracking/leak detection.
*/
export interface IDisposable {
dispose(): void;
}
import type { IDisposable } from './Types';
export type { IDisposable };
export function toDisposable(fn: () => void): IDisposable {
return { dispose: fn };
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { SortedList } from './SortedList';
import { MockLogService } from './TestUtils.test';
import { MockLogService } from '../TestUtils.test';
const deepStrictEqual = assert.deepStrictEqual;
@@ -4,7 +4,7 @@
*/
import { IdleTaskQueue } from './TaskQueue';
import type { ILogService } from './services/Services';
import type { ILogService } from '../services/Services';
// Work variables to avoid garbage collection.
let i = 0;
@@ -3,7 +3,7 @@
* @license MIT
*/
import type { ILogService } from './services/Services';
import type { ILogService } from '../services/Services';
interface ITaskQueue {
/**
+228
View File
@@ -0,0 +1,228 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
/** sequence params serialized to js arrays */
export type ParamsArray = (number | number[])[];
/** 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};
}
export interface IDisposable {
dispose(): void;
}
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export type XtermListener = (...args: any[]) => void;
/**
* A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
* this event.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
/** @deprecated See KeyboardEvent.keyCode */
keyCode: number;
key: string;
type: string;
code: string;
}
export const enum KeyboardResultType {
SEND_KEY,
SELECT_ALL,
PAGE_UP,
PAGE_DOWN
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
export interface ICharset {
[key: string]: string | undefined;
}
export interface IColor {
readonly css: string;
readonly rgba: number; // 32-bit int with rgba in each byte
}
export type IColorRGB = [red: number, green: number, blue: number];
/**
* 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
* moves around unexpectedly the link is tracked, as opposed to using a start position and
* finalizing it at the end.
*/
export interface IOscLinkData {
id?: string;
uri: string;
}
export interface IRowRange {
start: number;
end: number;
}
/**
* Interface for mouse events in the core.
*/
export const enum CoreMouseButton {
LEFT = 0,
MIDDLE = 1,
RIGHT = 2,
NONE = 3,
WHEEL = 4,
// additional buttons 1..8
// untested!
AUX1 = 8,
AUX2 = 9,
AUX3 = 10,
AUX4 = 11,
AUX5 = 12,
AUX6 = 13,
AUX7 = 14,
AUX8 = 15
}
export const enum CoreMouseAction {
UP = 0, // buttons, wheel
DOWN = 1, // buttons, wheel
LEFT = 2, // wheel only
RIGHT = 3, // wheel only
MOVE = 32 // buttons only
}
export interface ICoreMouseEvent {
/** column (zero based). */
col: number;
/** row (zero based). */
row: number;
/** xy pixel positions. */
x: number;
y: number;
/**
* Button the action occurred. Due to restrictions of the tracking protocols
* it is not possible to report multiple buttons at once.
* Wheel is treated as a button.
* There are invalid combinations of buttons and actions possible
* (like move + wheel), those are silently ignored by the MouseStateService.
*/
button: CoreMouseButton;
action: CoreMouseAction;
/**
* Modifier states.
* Protocols will add/ignore those based on specific restrictions.
*/
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
}
/**
* CoreMouseEventType
* To be reported to the browser component which events a mouse
* protocol wants to be catched and forwarded as an ICoreMouseEvent
* to MouseStateService.
*/
export const enum CoreMouseEventType {
NONE = 0,
/** any mousedown event */
DOWN = 1,
/** any mouseup event */
UP = 2,
/** any mousemove event while a button is held */
DRAG = 4,
/** any mousemove event without a button */
MOVE = 8,
/** any wheel event */
WHEEL = 16
}
/**
* Mouse protocol interface.
* A mouse protocol can be registered and activated at the MouseStateService.
* `events` should contain a list of needed events as a hint for the browser component
* to install/remove the appropriate event handlers.
* `restrict` applies further protocol specific restrictions like not allowed
* modifiers or filtering invalid event types.
*/
export interface ICoreMouseProtocol {
events: CoreMouseEventType;
restrict: (e: ICoreMouseEvent) => boolean;
}
/**
* CoreMouseEncoding
* The tracking encoding can be registered and activated at the MouseStateService.
* If a ICoreMouseEvent passes all procotol restrictions it will be encoded
* with the active encoding and sent out.
* Note: Returning an empty string will supress sending a mouse report,
* which can be used to skip creating falsey reports in limited encodings
* (DEFAULT only supports up to 223 1-based as coord value).
*/
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
// color events from common, used for OSC 4/10/11/12 and 104/110/111/112
export const enum ColorRequestType {
REPORT = 0,
SET = 1,
RESTORE = 2
}
// IntRange from https://stackoverflow.com/a/39495173
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
? Acc[number]
: Enumerate<N, [...Acc, Acc['length']]>;
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
export type ColorIndex = IntRange<0, 256>; // number from 0 to 255
export type AllColorIndex = ColorIndex | SpecialColorIndex;
export const enum SpecialColorIndex {
FOREGROUND = 256,
BACKGROUND = 257,
CURSOR = 258
}
export interface IColorReportRequest {
type: ColorRequestType.REPORT;
index: AllColorIndex;
}
export interface IColorSetRequest {
type: ColorRequestType.SET;
index: AllColorIndex;
color: IColorRGB;
}
export interface IColorRestoreRequest {
type: ColorRequestType.RESTORE;
index?: AllColorIndex;
}
export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
@@ -6,7 +6,7 @@
import { assert } from 'chai';
import { Buffer } from './Buffer';
import { CircularList } from '../CircularList';
import { MockOptionsService, MockBufferService, MockLogService, createCellData } from '../TestUtils.test';
import { MockOptionsService, MockBufferService, MockLogService, createCellData } from '../../TestUtils.test';
import { BufferLine, DEFAULT_ATTR_DATA } from './BufferLine';
import { BufferLineStringCache } from './BufferLineStringCache';
import { CellData } from './CellData';
@@ -16,7 +16,7 @@ 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 { Marker } from './Marker';
import { DEFAULT_CHARSET } from '../data/Charsets';
import { IBufferService, ILogService, IOptionsService } from '../services/Services';
import { IBufferService, ILogService, IOptionsService } from '../../services/Services';
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1

Some files were not shown because too many files have changed in this diff Show More