diff --git a/src/Buffer.test.ts b/src/Buffer.test.ts index d866fd56..618a9795 100644 --- a/src/Buffer.test.ts +++ b/src/Buffer.test.ts @@ -5,10 +5,10 @@ import { assert, expect } from 'chai'; import { ITerminal } from './Types'; -import { Buffer, DEFAULT_ATTR_DATA } from './Buffer'; +import { Buffer } from './Buffer'; import { CircularList } from './common/CircularList'; import { MockTerminal, TestTerminal } from './TestUtils.test'; -import { BufferLine, CellData } from './BufferLine'; +import { BufferLine, CellData, DEFAULT_ATTR_DATA } from './BufferLine'; const INIT_COLS = 80; const INIT_ROWS = 24; diff --git a/src/Buffer.ts b/src/Buffer.ts index db02fd0d..7e986a6c 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -7,16 +7,11 @@ import { CircularList, IInsertEvent } from './common/CircularList'; import { ITerminal, IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from './Types'; import { IBufferLine, ICellData, IAttributeData } from './core/Types'; import { IMarker } from 'xterm'; -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 { BufferLine, CellData, 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, DEFAULT_ATTR_DATA } from './BufferLine'; import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from './BufferReflow'; -import { DEFAULT_COLOR } from './renderer/atlas/Types'; import { EventEmitter2, IEvent } from './common/EventEmitter2'; import { Disposable } from '../lib/common/Lifecycle'; -export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0); - -export const DEFAULT_ATTR_DATA = new AttributeData(); - export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1 /** diff --git a/src/BufferLine.test.ts b/src/BufferLine.test.ts index 82e9610d..b9e40491 100644 --- a/src/BufferLine.test.ts +++ b/src/BufferLine.test.ts @@ -3,9 +3,8 @@ * @license MIT */ import * as chai from 'chai'; -import { BufferLine, CellData, Content, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './BufferLine'; +import { BufferLine, CellData, Content, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR } from './BufferLine'; import { CharData, IBufferLine } from './core/Types'; -import { DEFAULT_ATTR } from './Buffer'; class TestBufferLine extends BufferLine { diff --git a/src/BufferLine.ts b/src/BufferLine.ts index 92ed1de4..39b6116d 100644 --- a/src/BufferLine.ts +++ b/src/BufferLine.ts @@ -4,7 +4,9 @@ */ import { CharData, IBufferLine, ICellData, IColorRGB, IAttributeData } from './core/Types'; import { stringFromCodePoint } from './core/input/TextDecoder'; +import { DEFAULT_COLOR } from './common/Types'; +export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0); export const CHAR_DATA_ATTR_INDEX = 0; export const CHAR_DATA_CHAR_INDEX = 1; @@ -215,6 +217,8 @@ export class AttributeData implements IAttributeData { } } +export const DEFAULT_ATTR_DATA = new AttributeData(); + /** * CellData - represents a single Cell in the terminal buffer. */ diff --git a/src/InputHandler.test.ts b/src/InputHandler.test.ts index 3089aa0a..c0286779 100644 --- a/src/InputHandler.test.ts +++ b/src/InputHandler.test.ts @@ -6,10 +6,9 @@ import { assert, expect } from 'chai'; import { InputHandler } from './InputHandler'; import { MockInputHandlingTerminal, TestTerminal } from './TestUtils.test'; -import { DEFAULT_ATTR_DATA } from './Buffer'; import { Terminal } from './Terminal'; import { IBufferLine } from './core/Types'; -import { CellData, Attributes, AttributeData } from './BufferLine'; +import { CellData, Attributes, AttributeData, DEFAULT_ATTR_DATA } from './BufferLine'; describe('InputHandler', () => { describe('save and restore cursor', () => { diff --git a/src/InputHandler.ts b/src/InputHandler.ts index dc2e5eb2..ebdc9d0d 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -7,14 +7,13 @@ import { IInputHandler, IDcsHandler, IEscapeSequenceParser, IInputHandlingTerminal } from './Types'; import { C0, C1 } from './common/data/EscapeSequences'; import { CHARSETS, DEFAULT_CHARSET } from './core/data/Charsets'; -import { DEFAULT_ATTR_DATA } from './Buffer'; import { wcwidth } from './CharWidth'; import { EscapeSequenceParser } from './EscapeSequenceParser'; import { IDisposable } from 'xterm'; import { Disposable } from './common/Lifecycle'; import { concat } from './common/TypedArrayUtils'; import { StringToUtf32, stringFromCodePoint, utf32ToString } from './core/input/TextDecoder'; -import { CellData, Attributes, FgFlags, BgFlags, AttributeData, NULL_CELL_WIDTH, NULL_CELL_CODE } from './BufferLine'; +import { CellData, Attributes, FgFlags, BgFlags, AttributeData, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR_DATA } from './BufferLine'; import { EventEmitter2, IEvent } from './common/EventEmitter2'; /** diff --git a/src/Terminal.test.ts b/src/Terminal.test.ts index 69fbb8e2..06a02d68 100644 --- a/src/Terminal.test.ts +++ b/src/Terminal.test.ts @@ -6,8 +6,7 @@ import { assert, expect } from 'chai'; import { Terminal } from './Terminal'; import { MockViewport, MockCompositionHelper, MockRenderer } from './TestUtils.test'; -import { DEFAULT_ATTR_DATA } from './Buffer'; -import { CellData } from './BufferLine'; +import { CellData, DEFAULT_ATTR_DATA } from './BufferLine'; const INIT_COLS = 80; const INIT_ROWS = 24; diff --git a/src/Terminal.ts b/src/Terminal.ts index 3653efc7..0ff21b88 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -22,10 +22,9 @@ */ 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 { BufferSet } from './BufferSet'; -import { Buffer, MAX_BUFFER_SIZE, DEFAULT_ATTR_DATA } from './Buffer'; +import { Buffer, MAX_BUFFER_SIZE } from './Buffer'; import { CompositionHelper } from './CompositionHelper'; import { EventEmitter } from './common/EventEmitter'; import { Viewport } from './Viewport'; @@ -49,10 +48,10 @@ import { removeTerminalFromCache } from './renderer/atlas/CharAtlasCache'; import { DomRenderer } from './renderer/dom/DomRenderer'; import { IKeyboardEvent } from './common/Types'; import { evaluateKeyboardEvent } from './core/input/Keyboard'; -import { KeyboardResultType, ICharset } from './core/Types'; +import { KeyboardResultType, ICharset, IBufferLine, IAttributeData } from './core/Types'; import { clone } from './common/Clone'; import { EventEmitter2, IEvent } from './common/EventEmitter2'; -import { Attributes } from './BufferLine'; +import { Attributes, DEFAULT_ATTR_DATA } from './BufferLine'; import { applyWindowsMode } from './WindowsMode'; // Let it work inside Node.js for automated testing purposes. diff --git a/src/common/Types.ts b/src/common/Types.ts index b2111bfc..717de359 100644 --- a/src/common/Types.ts +++ b/src/common/Types.ts @@ -6,6 +6,8 @@ import { IEvent, EventEmitter2 } from './EventEmitter2'; import { IDeleteEvent, IInsertEvent } from './CircularList'; +export const DEFAULT_COLOR = 256; + export interface IDisposable { dispose(): void; } diff --git a/src/renderer/BaseRenderLayer.ts b/src/renderer/BaseRenderLayer.ts index 8b1e27c5..63846155 100644 --- a/src/renderer/BaseRenderLayer.ts +++ b/src/renderer/BaseRenderLayer.ts @@ -6,7 +6,8 @@ import { IRenderLayer, IColorSet, IRenderDimensions } from './Types'; import { ITerminal } from '../Types'; import { ICellData } from '../core/Types'; -import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier, DEFAULT_COLOR } from './atlas/Types'; +import { DEFAULT_COLOR } from '../common/Types'; +import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier } from './atlas/Types'; import BaseCharAtlas from './atlas/BaseCharAtlas'; import { acquireCharAtlas } from './atlas/CharAtlasCache'; import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from '../BufferLine'; diff --git a/src/renderer/atlas/CharAtlasUtils.ts b/src/renderer/atlas/CharAtlasUtils.ts index 5b1add39..c2eb2e1e 100644 --- a/src/renderer/atlas/CharAtlasUtils.ts +++ b/src/renderer/atlas/CharAtlasUtils.ts @@ -5,7 +5,8 @@ import { ITerminal } from '../../Types'; import { IColorSet } from '../Types'; -import { DEFAULT_COLOR, ICharAtlasConfig } from './Types'; +import { ICharAtlasConfig } from './Types'; +import { DEFAULT_COLOR } from '../../common/Types'; export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig { // null out some fields that don't matter diff --git a/src/renderer/atlas/StaticCharAtlas.ts b/src/renderer/atlas/StaticCharAtlas.ts index b54c833e..66beb363 100644 --- a/src/renderer/atlas/StaticCharAtlas.ts +++ b/src/renderer/atlas/StaticCharAtlas.ts @@ -3,10 +3,11 @@ * @license MIT */ -import { DIM_OPACITY, IGlyphIdentifier, DEFAULT_COLOR, ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types'; +import { DIM_OPACITY, IGlyphIdentifier, ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types'; import { generateStaticCharAtlasTexture } from './CharAtlasGenerator'; import BaseCharAtlas from './BaseCharAtlas'; import { is256Color } from './CharAtlasUtils'; +import { DEFAULT_COLOR } from '../../common/Types'; export default class StaticCharAtlas extends BaseCharAtlas { private _texture: HTMLCanvasElement | ImageBitmap; diff --git a/src/renderer/atlas/Types.ts b/src/renderer/atlas/Types.ts index 38923b2f..2459c72f 100644 --- a/src/renderer/atlas/Types.ts +++ b/src/renderer/atlas/Types.ts @@ -6,7 +6,6 @@ import { FontWeight } from 'xterm'; import { IColorSet } from '../Types'; -export const DEFAULT_COLOR = 256; export const INVERTED_DEFAULT_COLOR = 257; export const DIM_OPACITY = 0.5; diff --git a/src/renderer/dom/DomRendererRowFactory.test.ts b/src/renderer/dom/DomRendererRowFactory.test.ts index c795c5ae..f009407d 100644 --- a/src/renderer/dom/DomRendererRowFactory.test.ts +++ b/src/renderer/dom/DomRendererRowFactory.test.ts @@ -6,8 +6,7 @@ import jsdom = require('jsdom'); import { assert } from 'chai'; import { DomRendererRowFactory } from './DomRendererRowFactory'; -import { DEFAULT_ATTR, DEFAULT_ATTR_DATA } from '../../Buffer'; -import { BufferLine, CellData, FgFlags, BgFlags, Attributes, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from '../../BufferLine'; +import { BufferLine, CellData, FgFlags, BgFlags, Attributes, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, DEFAULT_ATTR_DATA } from '../../BufferLine'; import { ITerminalOptions } from '../../Types'; import { IBufferLine } from '../../core/Types';