change replaceCells to new interface
This commit is contained in:
@@ -71,7 +71,7 @@ describe('BufferLine', function(): void {
|
|||||||
line.set(2, [3, 'c', 0, 'c'.charCodeAt(0)]);
|
line.set(2, [3, 'c', 0, 'c'.charCodeAt(0)]);
|
||||||
line.set(3, [4, 'd', 0, 'd'.charCodeAt(0)]);
|
line.set(3, [4, 'd', 0, 'd'.charCodeAt(0)]);
|
||||||
line.set(4, [5, 'e', 0, 'e'.charCodeAt(0)]);
|
line.set(4, [5, 'e', 0, 'e'.charCodeAt(0)]);
|
||||||
line.replaceCells(2, 4, [6, 'f', 0, 'f'.charCodeAt(0)]);
|
line.replaceCells(2, 4, CellData.fromCharData([6, 'f', 0, 'f'.charCodeAt(0)]));
|
||||||
chai.expect(line.toArray()).eql([
|
chai.expect(line.toArray()).eql([
|
||||||
[1, 'a', 0, 'a'.charCodeAt(0)],
|
[1, 'a', 0, 'a'.charCodeAt(0)],
|
||||||
[2, 'b', 0, 'b'.charCodeAt(0)],
|
[2, 'b', 0, 'b'.charCodeAt(0)],
|
||||||
|
|||||||
+2
-3
@@ -311,10 +311,9 @@ export class BufferLine implements IBufferLine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public replaceCells(start: number, end: number, fillCharData: CharData): void {
|
public replaceCells(start: number, end: number, fillCellData: ICellData): void {
|
||||||
this._cell.setFromCharData(fillCharData);
|
|
||||||
while (start < end && start < this.length) {
|
while (start < end && start < this.length) {
|
||||||
this.setCell(start++, this._cell);
|
this.setCell(start++, fillCellData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -7,7 +7,7 @@
|
|||||||
import { IInputHandler, IDcsHandler, IEscapeSequenceParser, IBuffer, IInputHandlingTerminal } from './Types';
|
import { IInputHandler, IDcsHandler, IEscapeSequenceParser, IBuffer, IInputHandlingTerminal } from './Types';
|
||||||
import { C0, C1 } from './common/data/EscapeSequences';
|
import { C0, C1 } from './common/data/EscapeSequences';
|
||||||
import { CHARSETS, DEFAULT_CHARSET } from './core/data/Charsets';
|
import { CHARSETS, DEFAULT_CHARSET } from './core/data/Charsets';
|
||||||
import { DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './Buffer';
|
import { DEFAULT_ATTR, NULL_CELL_WIDTH, NULL_CELL_CODE } from './Buffer';
|
||||||
import { FLAGS } from './renderer/Types';
|
import { FLAGS } from './renderer/Types';
|
||||||
import { wcwidth } from './CharWidth';
|
import { wcwidth } from './CharWidth';
|
||||||
import { EscapeSequenceParser } from './EscapeSequenceParser';
|
import { EscapeSequenceParser } from './EscapeSequenceParser';
|
||||||
@@ -696,7 +696,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
line.replaceCells(
|
line.replaceCells(
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
[this._terminal.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]
|
this._terminal.buffer.getNullCell(this._terminal.eraseAttr())
|
||||||
);
|
);
|
||||||
if (clearWrap) {
|
if (clearWrap) {
|
||||||
line.isWrapped = false;
|
line.isWrapped = false;
|
||||||
@@ -916,7 +916,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).replaceCells(
|
this._terminal.buffer.lines.get(this._terminal.buffer.y + this._terminal.buffer.ybase).replaceCells(
|
||||||
this._terminal.buffer.x,
|
this._terminal.buffer.x,
|
||||||
this._terminal.buffer.x + (params[0] || 1),
|
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())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,9 +972,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
// make buffer local for faster access
|
// make buffer local for faster access
|
||||||
const buffer = this._terminal.buffer;
|
const buffer = this._terminal.buffer;
|
||||||
const line = buffer.lines.get(buffer.ybase + buffer.y);
|
const line = buffer.lines.get(buffer.ybase + buffer.y);
|
||||||
|
line.loadCell(buffer.x - 1, this._cell);
|
||||||
line.replaceCells(buffer.x,
|
line.replaceCells(buffer.x,
|
||||||
buffer.x + (params[0] || 1),
|
buffer.x + (params[0] || 1),
|
||||||
line.get(buffer.x - 1) || [DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]
|
(this._cell.content !== undefined) ? this._cell : buffer.getNullCell(DEFAULT_ATTR)
|
||||||
);
|
);
|
||||||
// FIXME: no updateRange here?
|
// FIXME: no updateRange here?
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -540,7 +540,7 @@ export interface IBufferLine {
|
|||||||
addCharToCell(index: number, codePoint: number): void;
|
addCharToCell(index: number, codePoint: number): void;
|
||||||
insertCells(pos: number, n: number, ch: ICellData): void;
|
insertCells(pos: number, n: number, ch: ICellData): void;
|
||||||
deleteCells(pos: number, n: number, fill: ICellData): void;
|
deleteCells(pos: number, n: number, fill: ICellData): void;
|
||||||
replaceCells(start: number, end: number, fill: CharData): void;
|
replaceCells(start: number, end: number, fill: ICellData): void;
|
||||||
resize(cols: number, fill: CharData, shrink?: boolean): void;
|
resize(cols: number, fill: CharData, shrink?: boolean): void;
|
||||||
fill(fillCharData: CharData): void;
|
fill(fillCharData: CharData): void;
|
||||||
copyFrom(line: IBufferLine): void;
|
copyFrom(line: IBufferLine): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user