mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
rename BufferLineJsArray as BufferLine
This commit is contained in:
+4
-10
@@ -7,7 +7,7 @@ import { CircularList } from './common/CircularList';
|
||||
import { CharData, ITerminal, IBuffer, IBufferLine, IBufferLineConstructor } from './Types';
|
||||
import { EventEmitter } from './EventEmitter';
|
||||
import { IMarker } from 'xterm';
|
||||
import { BufferLine, BufferLineJsArray, BufferLineTypedArray } from './BufferLine';
|
||||
import { BufferLine, BufferLineTypedArray } from './BufferLine';
|
||||
|
||||
export const DEFAULT_ATTR = (0 << 18) | (257 << 9) | (256 << 0);
|
||||
export const CHAR_DATA_ATTR_INDEX = 0;
|
||||
@@ -55,16 +55,10 @@ export class Buffer implements IBuffer {
|
||||
}
|
||||
|
||||
public setBufferLineFactory(type: string): void {
|
||||
if (type === 'JsArray') {
|
||||
if (this._bufferLineConstructor === BufferLineJsArray) {
|
||||
return;
|
||||
}
|
||||
this._bufferLineConstructor = BufferLineJsArray;
|
||||
if (type === 'JsArray' && this._bufferLineConstructor !== BufferLine) {
|
||||
this._bufferLineConstructor = BufferLine;
|
||||
this._recreateLines();
|
||||
} else if (type === 'TypedArray') {
|
||||
if (this._bufferLineConstructor === BufferLineTypedArray) {
|
||||
return;
|
||||
}
|
||||
} else if (type === 'TypedArray' && this._bufferLineConstructor !== BufferLineTypedArray) {
|
||||
this._bufferLineConstructor = BufferLineTypedArray;
|
||||
this._recreateLines();
|
||||
} else {
|
||||
|
||||
+4
-13
@@ -2,16 +2,16 @@
|
||||
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
import { CharData, IBufferLine, IBufferLineConstructor } from './Types';
|
||||
import { CharData, IBufferLine } from './Types';
|
||||
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer';
|
||||
|
||||
/**
|
||||
* Class representing a terminal line.
|
||||
*/
|
||||
export class BufferLineJsArray implements IBufferLine {
|
||||
export class BufferLine implements IBufferLine {
|
||||
static blankLine(cols: number, attr: number, isWrapped?: boolean): IBufferLine {
|
||||
const ch: CharData = [attr, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE];
|
||||
return new BufferLineJsArray(cols, ch, isWrapped);
|
||||
return new BufferLine(cols, ch, isWrapped);
|
||||
}
|
||||
protected _data: CharData[];
|
||||
public isWrapped = false;
|
||||
@@ -108,7 +108,7 @@ export class BufferLineJsArray implements IBufferLine {
|
||||
}
|
||||
|
||||
public clone(): IBufferLine {
|
||||
const newLine = new BufferLineJsArray(0);
|
||||
const newLine = new BufferLine(0);
|
||||
newLine.makeCopyOf(this);
|
||||
return newLine;
|
||||
}
|
||||
@@ -279,12 +279,3 @@ export class BufferLineTypedArray implements IBufferLine {
|
||||
return newLine;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* implementation switch
|
||||
* needed to test the different implementation throughout the
|
||||
* whole code base and tests
|
||||
* FIXME: remove once we are settled with one
|
||||
*/
|
||||
export const BufferLine = BufferLineJsArray;
|
||||
// export const BufferLine: IBufferLineConstructor = BufferLineTypedArray;
|
||||
|
||||
+1
-2
@@ -52,7 +52,6 @@ import { DomRenderer } from './renderer/dom/DomRenderer';
|
||||
import { IKeyboardEvent } from './common/Types';
|
||||
import { evaluateKeyboardEvent } from './core/input/Keyboard';
|
||||
import { KeyboardResultType, ICharset } from './core/Types';
|
||||
import { BufferLine, BufferLineJsArray } from './BufferLine';
|
||||
|
||||
// Let it work inside Node.js for automated testing purposes.
|
||||
const document = (typeof window !== 'undefined') ? window.document : null;
|
||||
@@ -107,7 +106,7 @@ const DEFAULT_OPTIONS: ITerminalOptions = {
|
||||
theme: null,
|
||||
rightClickSelectsWord: Browser.isMac,
|
||||
rendererType: 'canvas',
|
||||
bufferLineConstructor: (BufferLine === BufferLineJsArray) ? 'JsArray' : 'TypedArray'
|
||||
bufferLineConstructor: 'JsArray'
|
||||
};
|
||||
|
||||
export class Terminal extends EventEmitter implements ITerminal, IDisposable, IInputHandlingTerminal {
|
||||
|
||||
Reference in New Issue
Block a user