diff --git a/src/BufferLine.test.ts b/src/BufferLine.test.ts index 4ccfe96b..68384f35 100644 --- a/src/BufferLine.test.ts +++ b/src/BufferLine.test.ts @@ -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)], diff --git a/src/BufferLine.ts b/src/BufferLine.ts index 64cb1e19..fb1d40a9 100644 --- a/src/BufferLine.ts +++ b/src/BufferLine.ts @@ -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); } } } diff --git a/src/InputHandler.ts b/src/InputHandler.ts index c8f9e7f2..2776051d 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -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); } diff --git a/src/Types.ts b/src/Types.ts index 9a4401b6..e991ac42 100644 --- a/src/Types.ts +++ b/src/Types.ts @@ -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;