change deleteCells to new interface

This commit is contained in:
Jörg Breitbart
2019-01-12 14:58:30 +01:00
parent 523ff6e5fc
commit 4bf7f3eb89
4 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ describe('BufferLine', function(): void {
line.set(2, [3, 'c', 0, 'c'.charCodeAt(0)]);
line.set(3, [4, 'd', 0, 'd'.charCodeAt(0)]);
line.set(4, [5, 'e', 0, 'e'.charCodeAt(0)]);
line.deleteCells(1, 2, [6, 'f', 0, 'f'.charCodeAt(0)]);
line.deleteCells(1, 2, CellData.fromCharData([6, 'f', 0, 'f'.charCodeAt(0)]));
chai.expect(line.toArray()).eql([
[1, 'a', 0, 'a'.charCodeAt(0)],
[4, 'd', 0, 'd'.charCodeAt(0)],
+3 -5
View File
@@ -295,20 +295,18 @@ export class BufferLine implements IBufferLine {
}
}
public deleteCells(pos: number, n: number, fillCharData: CharData): void {
public deleteCells(pos: number, n: number, fillCellData: ICellData): void {
pos %= this.length;
if (n < this.length - pos) {
for (let i = 0; i < this.length - pos - n; ++i) {
this.setCell(pos + i, this.loadCell(pos + n + i, this._cell));
}
this._cell.setFromCharData(fillCharData);
for (let i = this.length - n; i < this.length; ++i) {
this.setCell(i, this._cell);
this.setCell(i, fillCellData);
}
} else {
this._cell.setFromCharData(fillCharData);
for (let i = pos; i < this.length; ++i) {
this.setCell(i, this._cell);
this.setCell(i, fillCellData);
}
}
}
+1 -1
View File
@@ -865,7 +865,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).deleteCells(
this._terminal.buffer.x,
params[0] || 1,
[this._terminal.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]
this._terminal.buffer.getNullCell(this._terminal.eraseAttr())
);
this._terminal.updateRange(this._terminal.buffer.y);
}
+1 -1
View File
@@ -539,7 +539,7 @@ export interface IBufferLine {
setDataFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number): void;
addCharToCell(index: number, codePoint: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: CharData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: CharData): void;
resize(cols: number, fill: CharData, shrink?: boolean): void;
fill(fillCharData: CharData): void;