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 { CharData, ITerminal, IBuffer, IBufferLine, IBufferLineConstructor } from './Types';
|
||||||
import { EventEmitter } from './EventEmitter';
|
import { EventEmitter } from './EventEmitter';
|
||||||
import { IMarker } from 'xterm';
|
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 DEFAULT_ATTR = (0 << 18) | (257 << 9) | (256 << 0);
|
||||||
export const CHAR_DATA_ATTR_INDEX = 0;
|
export const CHAR_DATA_ATTR_INDEX = 0;
|
||||||
@@ -55,16 +55,10 @@ export class Buffer implements IBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setBufferLineFactory(type: string): void {
|
public setBufferLineFactory(type: string): void {
|
||||||
if (type === 'JsArray') {
|
if (type === 'JsArray' && this._bufferLineConstructor !== BufferLine) {
|
||||||
if (this._bufferLineConstructor === BufferLineJsArray) {
|
this._bufferLineConstructor = BufferLine;
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._bufferLineConstructor = BufferLineJsArray;
|
|
||||||
this._recreateLines();
|
this._recreateLines();
|
||||||
} else if (type === 'TypedArray') {
|
} else if (type === 'TypedArray' && this._bufferLineConstructor !== BufferLineTypedArray) {
|
||||||
if (this._bufferLineConstructor === BufferLineTypedArray) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._bufferLineConstructor = BufferLineTypedArray;
|
this._bufferLineConstructor = BufferLineTypedArray;
|
||||||
this._recreateLines();
|
this._recreateLines();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+4
-13
@@ -2,16 +2,16 @@
|
|||||||
* 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, IBufferLineConstructor } from './Types';
|
import { CharData, IBufferLine } from './Types';
|
||||||
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer';
|
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a terminal line.
|
* Class representing a terminal line.
|
||||||
*/
|
*/
|
||||||
export class BufferLineJsArray implements IBufferLine {
|
export class BufferLine implements IBufferLine {
|
||||||
static blankLine(cols: number, attr: number, isWrapped?: boolean): IBufferLine {
|
static blankLine(cols: number, attr: number, isWrapped?: boolean): IBufferLine {
|
||||||
const ch: CharData = [attr, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE];
|
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[];
|
protected _data: CharData[];
|
||||||
public isWrapped = false;
|
public isWrapped = false;
|
||||||
@@ -108,7 +108,7 @@ export class BufferLineJsArray implements IBufferLine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public clone(): IBufferLine {
|
public clone(): IBufferLine {
|
||||||
const newLine = new BufferLineJsArray(0);
|
const newLine = new BufferLine(0);
|
||||||
newLine.makeCopyOf(this);
|
newLine.makeCopyOf(this);
|
||||||
return newLine;
|
return newLine;
|
||||||
}
|
}
|
||||||
@@ -279,12 +279,3 @@ export class BufferLineTypedArray implements IBufferLine {
|
|||||||
return newLine;
|
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 { IKeyboardEvent } from './common/Types';
|
||||||
import { evaluateKeyboardEvent } from './core/input/Keyboard';
|
import { evaluateKeyboardEvent } from './core/input/Keyboard';
|
||||||
import { KeyboardResultType, ICharset } from './core/Types';
|
import { KeyboardResultType, ICharset } from './core/Types';
|
||||||
import { BufferLine, BufferLineJsArray } from './BufferLine';
|
|
||||||
|
|
||||||
// Let it work inside Node.js for automated testing purposes.
|
// Let it work inside Node.js for automated testing purposes.
|
||||||
const document = (typeof window !== 'undefined') ? window.document : null;
|
const document = (typeof window !== 'undefined') ? window.document : null;
|
||||||
@@ -107,7 +106,7 @@ const DEFAULT_OPTIONS: ITerminalOptions = {
|
|||||||
theme: null,
|
theme: null,
|
||||||
rightClickSelectsWord: Browser.isMac,
|
rightClickSelectsWord: Browser.isMac,
|
||||||
rendererType: 'canvas',
|
rendererType: 'canvas',
|
||||||
bufferLineConstructor: (BufferLine === BufferLineJsArray) ? 'JsArray' : 'TypedArray'
|
bufferLineConstructor: 'JsArray'
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Terminal extends EventEmitter implements ITerminal, IDisposable, IInputHandlingTerminal {
|
export class Terminal extends EventEmitter implements ITerminal, IDisposable, IInputHandlingTerminal {
|
||||||
|
|||||||
Reference in New Issue
Block a user