mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Remove getNullCell
Replace with fetching cell (0,0) and using that as the initial null cell. We can reconsider adding this back if it's needed
This commit is contained in:
@@ -16,9 +16,7 @@ abstract class BaseSerializeHandler {
|
||||
constructor(private _buffer: IBuffer) { }
|
||||
|
||||
serialize(startRow: number, endRow: number): string {
|
||||
// we need two of them to flip between old and new cell
|
||||
const cell1 = this._buffer.getNullCell();
|
||||
const cell2 = this._buffer.getNullCell();
|
||||
const { cell1, cell2 } = this._getWorkCells();
|
||||
let oldCell = cell1;
|
||||
|
||||
this._beforeSerialize(endRow - startRow);
|
||||
@@ -44,6 +42,22 @@ abstract class BaseSerializeHandler {
|
||||
return this._serializeString();
|
||||
}
|
||||
|
||||
private _getWorkCells(): { cell1: IBufferCell, cell2: IBufferCell } {
|
||||
const line = this._buffer.getLine(0);
|
||||
if (!line) {
|
||||
throw new Error('Could not fetch first line for serialization');
|
||||
}
|
||||
const cell1 = line.getCell(0);
|
||||
if (!cell1) {
|
||||
throw new Error('Could not fetch first cell for serialization');
|
||||
}
|
||||
const cell2 = line.getCell(0);
|
||||
if (!cell2) {
|
||||
throw new Error('Could not fetch first cell for serialization');
|
||||
}
|
||||
return { cell1, cell2 };
|
||||
}
|
||||
|
||||
protected _nextCell(cell: IBufferCell, oldCell: IBufferCell, row: number, col: number): void { }
|
||||
protected _rowEnd(row: number): void { }
|
||||
protected _beforeSerialize(rows: number): void { }
|
||||
|
||||
@@ -204,7 +204,6 @@ class BufferApiView implements IBufferApi {
|
||||
}
|
||||
return new BufferLineApiView(line);
|
||||
}
|
||||
public getNullCell(): IBufferCellApi { return new CellData(); }
|
||||
}
|
||||
|
||||
class BufferLineApiView implements IBufferLineApi {
|
||||
|
||||
Vendored
-7
@@ -955,13 +955,6 @@ declare module 'xterm' {
|
||||
* @param y The line index to get.
|
||||
*/
|
||||
getLine(y: number): IBufferLine | undefined;
|
||||
|
||||
/**
|
||||
* Creates an empty cell object suitable as a cell reference in
|
||||
* `line.getCell(x, cell)`. Use this to avoid costly recreation of
|
||||
* cell objects when dealing with tons of cells.
|
||||
*/
|
||||
getNullCell(): IBufferCell;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user