first step to buffer redesign: class TerminalLine; discourage low level index access to cells

This commit is contained in:
Jörg Breitbart
2018-08-25 22:41:42 +02:00
parent e769e787a8
commit 0340d91150
20 changed files with 358 additions and 247 deletions
+6 -5
View File
@@ -8,6 +8,7 @@ import { LineData, IInputHandlingTerminal, IViewport, ICompositionHelper, ITermi
import { Buffer, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from '../Buffer';
import * as Browser from '../shared/utils/Browser';
import { ITheme, IDisposable, IMarker } from 'xterm';
import { TerminalLine } from '../TerminalLine';
export class MockTerminal implements ITerminal {
markers: IMarker[];
@@ -145,8 +146,8 @@ export class MockTerminal implements ITerminal {
refresh(start: number, end: number): void {
throw new Error('Method not implemented.');
}
blankLine(cur?: boolean, isWrapped?: boolean, cols?: number): LineData {
const line: LineData = [];
blankLine(cur?: boolean, isWrapped?: boolean, cols?: number): TerminalLine {
const line = new TerminalLine();
cols = cols || this.cols;
for (let i = 0; i < cols; i++) {
line.push([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
@@ -228,7 +229,7 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal {
eraseLeft(x: number, y: number): void {
throw new Error('Method not implemented.');
}
blankLine(cur?: boolean, isWrapped?: boolean): [number, string, number, number][] {
blankLine(cur?: boolean, isWrapped?: boolean): TerminalLine {
throw new Error('Method not implemented.');
}
prevStop(x?: number): number {
@@ -295,7 +296,7 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal {
export class MockBuffer implements IBuffer {
isCursorInViewport: boolean;
lines: ICircularList<[number, string, number, number][]>;
lines: ICircularList<TerminalLine>;
ydisp: number;
ybase: number;
hasScrollback: boolean;
@@ -318,7 +319,7 @@ export class MockBuffer implements IBuffer {
prevStop(x?: number): number {
throw new Error('Method not implemented.');
}
setLines(lines: ICircularList<[number, string, number, number][]>): void {
setLines(lines: ICircularList<TerminalLine>): void {
this.lines = lines;
}
}