Move a bunch of types to core
This commit is contained in:
+3
-24
@@ -4,9 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { CircularList, IInsertEvent } from './common/CircularList';
|
import { CircularList, IInsertEvent } from './common/CircularList';
|
||||||
import { ITerminal, IBuffer, IBufferLine, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult, ICellData, IAttributeData } from './Types';
|
import { ITerminal, IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from './Types';
|
||||||
|
import { IBufferLine, ICellData, IAttributeData } from './core/Types';
|
||||||
import { IMarker } from 'xterm';
|
import { IMarker } from 'xterm';
|
||||||
import { BufferLine, CellData, AttributeData } from './BufferLine';
|
import { BufferLine, CellData, AttributeData, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './BufferLine';
|
||||||
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from './BufferReflow';
|
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from './BufferReflow';
|
||||||
import { DEFAULT_COLOR } from './renderer/atlas/Types';
|
import { DEFAULT_COLOR } from './renderer/atlas/Types';
|
||||||
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
||||||
@@ -16,30 +17,8 @@ export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
|
|||||||
|
|
||||||
export const DEFAULT_ATTR_DATA = new AttributeData();
|
export const DEFAULT_ATTR_DATA = new AttributeData();
|
||||||
|
|
||||||
export const CHAR_DATA_ATTR_INDEX = 0;
|
|
||||||
export const CHAR_DATA_CHAR_INDEX = 1;
|
|
||||||
export const CHAR_DATA_WIDTH_INDEX = 2;
|
|
||||||
export const CHAR_DATA_CODE_INDEX = 3;
|
|
||||||
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
|
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
|
||||||
|
|
||||||
/**
|
|
||||||
* Null cell - a real empty cell (containing nothing).
|
|
||||||
* Note that code should always be 0 for a null cell as
|
|
||||||
* several test condition of the buffer line rely on this.
|
|
||||||
*/
|
|
||||||
export const NULL_CELL_CHAR = '';
|
|
||||||
export const NULL_CELL_WIDTH = 1;
|
|
||||||
export const NULL_CELL_CODE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whitespace cell.
|
|
||||||
* This is meant as a replacement for empty cells when needed
|
|
||||||
* during rendering lines to preserve correct aligment.
|
|
||||||
*/
|
|
||||||
export const WHITESPACE_CELL_CHAR = ' ';
|
|
||||||
export const WHITESPACE_CELL_WIDTH = 1;
|
|
||||||
export const WHITESPACE_CELL_CODE = 32;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a terminal buffer (an internal state of the terminal), where the
|
* This class represents a terminal buffer (an internal state of the terminal), where the
|
||||||
* following information is stored (in high-level):
|
* following information is stored (in high-level):
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import { BufferLine, CellData, Content } from './BufferLine';
|
import { BufferLine, CellData, Content, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './BufferLine';
|
||||||
import { CharData, IBufferLine } from './Types';
|
import { CharData, IBufferLine } from './core/Types';
|
||||||
import { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR } from './Buffer';
|
import { DEFAULT_ATTR } from './Buffer';
|
||||||
|
|
||||||
|
|
||||||
class TestBufferLine extends BufferLine {
|
class TestBufferLine extends BufferLine {
|
||||||
|
|||||||
+24
-2
@@ -2,11 +2,33 @@
|
|||||||
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
import { CharData, IBufferLine, ICellData, IColorRGB, IAttributeData } from './Types';
|
import { CharData, IBufferLine, ICellData, IColorRGB, IAttributeData } from './core/Types';
|
||||||
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, WHITESPACE_CELL_CHAR, CHAR_DATA_ATTR_INDEX } from './Buffer';
|
|
||||||
import { stringFromCodePoint } from './core/input/TextDecoder';
|
import { stringFromCodePoint } from './core/input/TextDecoder';
|
||||||
|
|
||||||
|
|
||||||
|
export const CHAR_DATA_ATTR_INDEX = 0;
|
||||||
|
export const CHAR_DATA_CHAR_INDEX = 1;
|
||||||
|
export const CHAR_DATA_WIDTH_INDEX = 2;
|
||||||
|
export const CHAR_DATA_CODE_INDEX = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Null cell - a real empty cell (containing nothing).
|
||||||
|
* Note that code should always be 0 for a null cell as
|
||||||
|
* several test condition of the buffer line rely on this.
|
||||||
|
*/
|
||||||
|
export const NULL_CELL_CHAR = '';
|
||||||
|
export const NULL_CELL_WIDTH = 1;
|
||||||
|
export const NULL_CELL_CODE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whitespace cell.
|
||||||
|
* This is meant as a replacement for empty cells when needed
|
||||||
|
* during rendering lines to preserve correct aligment.
|
||||||
|
*/
|
||||||
|
export const WHITESPACE_CELL_CHAR = ' ';
|
||||||
|
export const WHITESPACE_CELL_WIDTH = 1;
|
||||||
|
export const WHITESPACE_CELL_CODE = 32;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* buffer memory layout:
|
* buffer memory layout:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './BufferLine';
|
||||||
import { reflowSmallerGetNewLineLengths } from './BufferReflow';
|
import { reflowSmallerGetNewLineLengths } from './BufferReflow';
|
||||||
import { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './Buffer';
|
|
||||||
|
|
||||||
describe('BufferReflow', () => {
|
describe('BufferReflow', () => {
|
||||||
describe('reflowSmallerGetNewLineLengths', () => {
|
describe('reflowSmallerGetNewLineLengths', () => {
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { BufferLine } from './BufferLine';
|
import { BufferLine } from './BufferLine';
|
||||||
import { CircularList } from './common/CircularList';
|
import { CircularList } from './common/CircularList';
|
||||||
import { IBufferLine, ICellData } from './Types';
|
import { IBufferLine, ICellData } from './core/Types';
|
||||||
|
|
||||||
export interface INewLayoutResult {
|
export interface INewLayoutResult {
|
||||||
layout: number[];
|
layout: number[];
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IBufferSet, IAttributeData, IBuffer } from './Types';
|
import { ITerminal, IBufferSet, IBuffer } from './Types';
|
||||||
|
import { IAttributeData } from './core/Types';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import { TestTerminal } from './TestUtils.test';
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { getStringCellWidth, wcwidth } from './CharWidth';
|
import { getStringCellWidth, wcwidth } from './CharWidth';
|
||||||
import { IBuffer } from './Types';
|
import { IBuffer } from './Types';
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
import { CellData, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './BufferLine';
|
||||||
import { CellData } from './BufferLine';
|
|
||||||
|
|
||||||
|
|
||||||
describe('getStringCellWidth', function(): void {
|
describe('getStringCellWidth', function(): void {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { InputHandler } from './InputHandler';
|
|||||||
import { MockInputHandlingTerminal, TestTerminal } from './TestUtils.test';
|
import { MockInputHandlingTerminal, TestTerminal } from './TestUtils.test';
|
||||||
import { DEFAULT_ATTR_DATA } from './Buffer';
|
import { DEFAULT_ATTR_DATA } from './Buffer';
|
||||||
import { Terminal } from './Terminal';
|
import { Terminal } from './Terminal';
|
||||||
import { IBufferLine } from './Types';
|
import { IBufferLine } from './core/Types';
|
||||||
import { CellData, Attributes, AttributeData } from './BufferLine';
|
import { CellData, Attributes, AttributeData } from './BufferLine';
|
||||||
|
|
||||||
describe('InputHandler', () => {
|
describe('InputHandler', () => {
|
||||||
|
|||||||
+2
-2
@@ -7,14 +7,14 @@
|
|||||||
import { IInputHandler, IDcsHandler, IEscapeSequenceParser, IInputHandlingTerminal } from './Types';
|
import { IInputHandler, IDcsHandler, IEscapeSequenceParser, IInputHandlingTerminal } from './Types';
|
||||||
import { C0, C1 } from './common/data/EscapeSequences';
|
import { C0, C1 } from './common/data/EscapeSequences';
|
||||||
import { CHARSETS, DEFAULT_CHARSET } from './core/data/Charsets';
|
import { CHARSETS, DEFAULT_CHARSET } from './core/data/Charsets';
|
||||||
import { NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR_DATA } from './Buffer';
|
import { DEFAULT_ATTR_DATA } from './Buffer';
|
||||||
import { wcwidth } from './CharWidth';
|
import { wcwidth } from './CharWidth';
|
||||||
import { EscapeSequenceParser } from './EscapeSequenceParser';
|
import { EscapeSequenceParser } from './EscapeSequenceParser';
|
||||||
import { IDisposable } from 'xterm';
|
import { IDisposable } from 'xterm';
|
||||||
import { Disposable } from './common/Lifecycle';
|
import { Disposable } from './common/Lifecycle';
|
||||||
import { concat } from './common/TypedArrayUtils';
|
import { concat } from './common/TypedArrayUtils';
|
||||||
import { StringToUtf32, stringFromCodePoint, utf32ToString } from './core/input/TextDecoder';
|
import { StringToUtf32, stringFromCodePoint, utf32ToString } from './core/input/TextDecoder';
|
||||||
import { CellData, Attributes, FgFlags, BgFlags, AttributeData } from './BufferLine';
|
import { CellData, Attributes, FgFlags, BgFlags, AttributeData, NULL_CELL_WIDTH, NULL_CELL_CODE } from './BufferLine';
|
||||||
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
import { EventEmitter2, IEvent } from './common/EventEmitter2';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { IMouseZoneManager, IMouseZone, ILinkMatcher, ITerminal, IBufferLine } from './Types';
|
import { IMouseZoneManager, IMouseZone, ILinkMatcher, ITerminal } from './Types';
|
||||||
|
import { IBufferLine } from './core/Types';
|
||||||
import { Linkifier } from './Linkifier';
|
import { Linkifier } from './Linkifier';
|
||||||
import { MockBuffer, MockTerminal, TestTerminal } from './TestUtils.test';
|
import { MockBuffer, MockTerminal, TestTerminal } from './TestUtils.test';
|
||||||
import { CircularList } from './common/CircularList';
|
import { CircularList } from './common/CircularList';
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import { CharMeasure } from './CharMeasure';
|
|||||||
import { SelectionManager, SelectionMode } from './SelectionManager';
|
import { SelectionManager, SelectionMode } from './SelectionManager';
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { ITerminal, IBuffer, IBufferLine } from './Types';
|
import { ITerminal, IBuffer } from './Types';
|
||||||
|
import { IBufferLine } from './core/Types';
|
||||||
import { MockTerminal } from './TestUtils.test';
|
import { MockTerminal } from './TestUtils.test';
|
||||||
import { BufferLine, CellData } from './BufferLine';
|
import { BufferLine, CellData } from './BufferLine';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, ISelectionManager, IBuffer, IBufferLine, ISelectionRedrawRequestEvent } from './Types';
|
import { ITerminal, ISelectionManager, IBuffer, ISelectionRedrawRequestEvent } from './Types';
|
||||||
|
import { IBufferLine } from './core/Types';
|
||||||
import { MouseHelper } from './MouseHelper';
|
import { MouseHelper } from './MouseHelper';
|
||||||
import * as Browser from './common/Platform';
|
import * as Browser from './common/Platform';
|
||||||
import { CharMeasure } from './CharMeasure';
|
import { CharMeasure } from './CharMeasure';
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ import * as path from 'path';
|
|||||||
import * as pty from 'node-pty';
|
import * as pty from 'node-pty';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { Terminal } from './Terminal';
|
import { Terminal } from './Terminal';
|
||||||
import { WHITESPACE_CELL_CHAR } from './Buffer';
|
|
||||||
import { IViewport } from './Types';
|
import { IViewport } from './Types';
|
||||||
import { CellData } from './BufferLine';
|
import { CellData, WHITESPACE_CELL_CHAR } from './BufferLine';
|
||||||
|
|
||||||
class TestTerminal extends Terminal {
|
class TestTerminal extends Terminal {
|
||||||
innerWrite(): void { this._innerWrite(); }
|
innerWrite(): void { this._innerWrite(); }
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@
|
|||||||
* http://linux.die.net/man/7/urxvt
|
* http://linux.die.net/man/7/urxvt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminalOptions, ITerminal, IBrowser, ILinkifier, ILinkMatcherOptions, CustomKeyEventHandler, LinkMatcherHandler, CharacterJoinerHandler, IBufferLine, IAttributeData, IMouseZoneManager } from './Types';
|
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminalOptions, ITerminal, IBrowser, ILinkifier, ILinkMatcherOptions, CustomKeyEventHandler, LinkMatcherHandler, CharacterJoinerHandler, IMouseZoneManager } from './Types';
|
||||||
|
import { IBufferLine, IAttributeData } from './core/Types';
|
||||||
import { IRenderer } from './renderer/Types';
|
import { IRenderer } from './renderer/Types';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { Buffer, MAX_BUFFER_SIZE, DEFAULT_ATTR_DATA } from './Buffer';
|
import { Buffer, MAX_BUFFER_SIZE, DEFAULT_ATTR_DATA } from './Buffer';
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from './renderer/Types';
|
import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from './renderer/Types';
|
||||||
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine, IBufferStringIterator, ICellData, IAttributeData } from './Types';
|
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferStringIterator } from './Types';
|
||||||
|
import { IBufferLine, ICellData, IAttributeData } from './core/Types';
|
||||||
import { ICircularList, XtermListener } from './common/Types';
|
import { ICircularList, XtermListener } from './common/Types';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import * as Browser from './common/Platform';
|
import * as Browser from './common/Platform';
|
||||||
|
|||||||
+1
-81
@@ -5,13 +5,12 @@
|
|||||||
|
|
||||||
import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable } from 'xterm';
|
import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable } from 'xterm';
|
||||||
import { IColorSet, IRenderer } from './renderer/Types';
|
import { IColorSet, IRenderer } from './renderer/Types';
|
||||||
import { ICharset } from './core/Types';
|
import { ICharset, IAttributeData, ICellData, IBufferLine, CharData } from './core/Types';
|
||||||
import { ICircularList } from './common/Types';
|
import { ICircularList } from './common/Types';
|
||||||
import { IEvent } from './common/EventEmitter2';
|
import { IEvent } from './common/EventEmitter2';
|
||||||
|
|
||||||
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
||||||
|
|
||||||
export type CharData = [number, string, number, number];
|
|
||||||
export type LineData = CharData[];
|
export type LineData = CharData[];
|
||||||
|
|
||||||
export type LinkMatcherHandler = (event: MouseEvent, uri: string) => void;
|
export type LinkMatcherHandler = (event: MouseEvent, uri: string) => void;
|
||||||
@@ -525,85 +524,6 @@ export interface IEscapeSequenceParser extends IDisposable {
|
|||||||
clearErrorHandler(): void;
|
clearErrorHandler(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RGB color type */
|
|
||||||
export type IColorRGB = [number, number, number];
|
|
||||||
|
|
||||||
/** Attribute data */
|
|
||||||
export interface IAttributeData {
|
|
||||||
fg: number;
|
|
||||||
bg: number;
|
|
||||||
|
|
||||||
clone(): IAttributeData;
|
|
||||||
|
|
||||||
// flags
|
|
||||||
isInverse(): number;
|
|
||||||
isBold(): number;
|
|
||||||
isUnderline(): number;
|
|
||||||
isBlink(): number;
|
|
||||||
isInvisible(): number;
|
|
||||||
isItalic(): number;
|
|
||||||
isDim(): number;
|
|
||||||
|
|
||||||
// color modes
|
|
||||||
getFgColorMode(): number;
|
|
||||||
getBgColorMode(): number;
|
|
||||||
isFgRGB(): boolean;
|
|
||||||
isBgRGB(): boolean;
|
|
||||||
isFgPalette(): boolean;
|
|
||||||
isBgPalette(): boolean;
|
|
||||||
isFgDefault(): boolean;
|
|
||||||
isBgDefault(): boolean;
|
|
||||||
|
|
||||||
// colors
|
|
||||||
getFgColor(): number;
|
|
||||||
getBgColor(): 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, fg: number, bg: number): void;
|
|
||||||
addCodepointToCell(index: number, codePoint: 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): void;
|
|
||||||
resize(cols: number, fill: ICellData): void;
|
|
||||||
fill(fillCellData: ICellData): void;
|
|
||||||
copyFrom(line: IBufferLine): void;
|
|
||||||
clone(): IBufferLine;
|
|
||||||
getTrimmedLength(): number;
|
|
||||||
translateToString(trimRight?: boolean, startCol?: number, endCol?: 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 IMouseZoneManager extends IDisposable {
|
export interface IMouseZoneManager extends IDisposable {
|
||||||
add(zone: IMouseZone): void;
|
add(zone: IMouseZone): void;
|
||||||
clearAll(start?: number, end?: number): void;
|
clearAll(start?: number, end?: number): void;
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { IDisposable } from 'xterm';
|
import { IDisposable } from 'xterm';
|
||||||
import { ITerminal } from './Types';
|
import { ITerminal } from './Types';
|
||||||
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './Buffer';
|
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './BufferLine';
|
||||||
|
|
||||||
export function applyWindowsMode(terminal: ITerminal): IDisposable {
|
export function applyWindowsMode(terminal: ITerminal): IDisposable {
|
||||||
// Winpty does not support wraparound mode which means that lines will never
|
// Winpty does not support wraparound mode which means that lines will never
|
||||||
|
|||||||
@@ -19,3 +19,82 @@ export interface IKeyboardResult {
|
|||||||
export interface ICharset {
|
export interface ICharset {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CharData = [number, string, number, number];
|
||||||
|
export type IColorRGB = [number, number, number];
|
||||||
|
|
||||||
|
/** Attribute data */
|
||||||
|
export interface IAttributeData {
|
||||||
|
fg: number;
|
||||||
|
bg: number;
|
||||||
|
|
||||||
|
clone(): IAttributeData;
|
||||||
|
|
||||||
|
// flags
|
||||||
|
isInverse(): number;
|
||||||
|
isBold(): number;
|
||||||
|
isUnderline(): number;
|
||||||
|
isBlink(): number;
|
||||||
|
isInvisible(): number;
|
||||||
|
isItalic(): number;
|
||||||
|
isDim(): number;
|
||||||
|
|
||||||
|
// color modes
|
||||||
|
getFgColorMode(): number;
|
||||||
|
getBgColorMode(): number;
|
||||||
|
isFgRGB(): boolean;
|
||||||
|
isBgRGB(): boolean;
|
||||||
|
isFgPalette(): boolean;
|
||||||
|
isBgPalette(): boolean;
|
||||||
|
isFgDefault(): boolean;
|
||||||
|
isBgDefault(): boolean;
|
||||||
|
|
||||||
|
// colors
|
||||||
|
getFgColor(): number;
|
||||||
|
getBgColor(): 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, fg: number, bg: number): void;
|
||||||
|
addCodepointToCell(index: number, codePoint: 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): void;
|
||||||
|
resize(cols: number, fill: ICellData): void;
|
||||||
|
fill(fillCellData: ICellData): void;
|
||||||
|
copyFrom(line: IBufferLine): void;
|
||||||
|
clone(): IBufferLine;
|
||||||
|
getTrimmedLength(): number;
|
||||||
|
translateToString(trimRight?: boolean, startCol?: number, endCol?: 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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IBufferLine } from '../Types';
|
import { ITerminal } from '../Types';
|
||||||
|
import { IBufferLine } from '../core/Types';
|
||||||
import { ICircularList } from '../common/Types';
|
import { ICircularList } from '../common/Types';
|
||||||
import { C0 } from '../common/data/EscapeSequences';
|
import { C0 } from '../common/data/EscapeSequences';
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IRenderLayer, IColorSet, IRenderDimensions } from './Types';
|
import { IRenderLayer, IColorSet, IRenderDimensions } from './Types';
|
||||||
import { ITerminal, ICellData } from '../Types';
|
import { ITerminal } from '../Types';
|
||||||
|
import { ICellData } from '../core/Types';
|
||||||
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier, DEFAULT_COLOR } from './atlas/Types';
|
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier, DEFAULT_COLOR } from './atlas/Types';
|
||||||
import BaseCharAtlas from './atlas/BaseCharAtlas';
|
import BaseCharAtlas from './atlas/BaseCharAtlas';
|
||||||
import { acquireCharAtlas } from './atlas/CharAtlasCache';
|
import { acquireCharAtlas } from './atlas/CharAtlasCache';
|
||||||
import { CellData, AttributeData } from '../BufferLine';
|
import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from '../BufferLine';
|
||||||
import { WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from '../Buffer';
|
|
||||||
import { JoinedCellData } from './CharacterJoinerRegistry';
|
import { JoinedCellData } from './CharacterJoinerRegistry';
|
||||||
|
|
||||||
export abstract class BaseRenderLayer implements IRenderLayer {
|
export abstract class BaseRenderLayer implements IRenderLayer {
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
|
||||||
import { MockTerminal, MockBuffer } from '../TestUtils.test';
|
import { MockTerminal, MockBuffer } from '../TestUtils.test';
|
||||||
@@ -6,7 +11,7 @@ import { CircularList } from '../common/CircularList';
|
|||||||
import { ICharacterJoinerRegistry } from './Types';
|
import { ICharacterJoinerRegistry } from './Types';
|
||||||
import { CharacterJoinerRegistry } from './CharacterJoinerRegistry';
|
import { CharacterJoinerRegistry } from './CharacterJoinerRegistry';
|
||||||
import { BufferLine, CellData } from '../BufferLine';
|
import { BufferLine, CellData } from '../BufferLine';
|
||||||
import { IBufferLine } from '../Types';
|
import { IBufferLine } from '../core/Types';
|
||||||
|
|
||||||
describe('CharacterJoinerRegistry', () => {
|
describe('CharacterJoinerRegistry', () => {
|
||||||
let registry: ICharacterJoinerRegistry;
|
let registry: ICharacterJoinerRegistry;
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
import { ITerminal, IBufferLine, ICellData, CharData } from '../Types';
|
/**
|
||||||
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ITerminal } from '../Types';
|
||||||
|
import { IBufferLine, ICellData, CharData } from '../core/Types';
|
||||||
import { ICharacterJoinerRegistry, ICharacterJoiner } from './Types';
|
import { ICharacterJoinerRegistry, ICharacterJoiner } from './Types';
|
||||||
import { CellData, Content, AttributeData } from '../BufferLine';
|
import { CellData, Content, AttributeData, WHITESPACE_CELL_CHAR } from '../BufferLine';
|
||||||
import { WHITESPACE_CELL_CHAR } from '../Buffer';
|
|
||||||
|
|
||||||
export class JoinedCellData extends AttributeData implements ICellData {
|
export class JoinedCellData extends AttributeData implements ICellData {
|
||||||
private _width: number;
|
private _width: number;
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
import { IColorSet, IRenderDimensions } from './Types';
|
import { IColorSet, IRenderDimensions } from './Types';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { ITerminal, ICellData } from '../Types';
|
import { ITerminal } from '../Types';
|
||||||
|
import { ICellData } from '../core/Types';
|
||||||
import { CellData } from '../BufferLine';
|
import { CellData } from '../BufferLine';
|
||||||
|
|
||||||
interface ICursorState {
|
interface ICursorState {
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { NULL_CELL_CODE } from '../Buffer';
|
|
||||||
import { IColorSet, IRenderDimensions, ICharacterJoinerRegistry } from './Types';
|
import { IColorSet, IRenderDimensions, ICharacterJoinerRegistry } from './Types';
|
||||||
import { CharData, ITerminal, ICellData } from '../Types';
|
import { ITerminal } from '../Types';
|
||||||
|
import { CharData, ICellData } from '../core/Types';
|
||||||
import { GridCache } from './GridCache';
|
import { GridCache } from './GridCache';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { CellData, AttributeData, Content } from '../BufferLine';
|
import { CellData, AttributeData, Content, NULL_CELL_CODE } from '../BufferLine';
|
||||||
import { JoinedCellData } from './CharacterJoinerRegistry';
|
import { JoinedCellData } from './CharacterJoinerRegistry';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
import jsdom = require('jsdom');
|
import jsdom = require('jsdom');
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { DomRendererRowFactory } from './DomRendererRowFactory';
|
import { DomRendererRowFactory } from './DomRendererRowFactory';
|
||||||
import { DEFAULT_ATTR, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR_DATA } from '../../Buffer';
|
import { DEFAULT_ATTR, DEFAULT_ATTR_DATA } from '../../Buffer';
|
||||||
import { BufferLine, CellData, FgFlags, BgFlags, Attributes } from '../../BufferLine';
|
import { BufferLine, CellData, FgFlags, BgFlags, Attributes, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from '../../BufferLine';
|
||||||
import { IBufferLine, ITerminalOptions } from '../../Types';
|
import { ITerminalOptions } from '../../Types';
|
||||||
|
import { IBufferLine } from '../../core/Types';
|
||||||
|
|
||||||
describe('DomRendererRowFactory', () => {
|
describe('DomRendererRowFactory', () => {
|
||||||
let dom: jsdom.JSDOM;
|
let dom: jsdom.JSDOM;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../Buffer';
|
import { ITerminalOptions } from '../../Types';
|
||||||
import { IBufferLine, ITerminalOptions } from '../../Types';
|
import { IBufferLine } from '../../core/Types';
|
||||||
import { INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
import { INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
||||||
import { CellData, AttributeData } from '../../BufferLine';
|
import { CellData, AttributeData, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../BufferLine';
|
||||||
|
|
||||||
export const BOLD_CLASS = 'xterm-bold';
|
export const BOLD_CLASS = 'xterm-bold';
|
||||||
export const DIM_CLASS = 'xterm-dim';
|
export const DIM_CLASS = 'xterm-dim';
|
||||||
|
|||||||
Reference in New Issue
Block a user