Fix row removal in reflowLarger
This commit is contained in:
+2
-11
@@ -292,21 +292,12 @@ export class Buffer implements IBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear out remaining cells or fragments could remain
|
// Clear out remaining cells or fragments could remain
|
||||||
// TODO: @jerch can this be a const?
|
// TODO: @jerch can fillCharData be a const?
|
||||||
const fillCharData: CharData = [DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE];
|
const fillCharData: CharData = [DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE];
|
||||||
wrappedLines[destLineIndex].replaceCells(destCol, newCols, fillCharData);
|
wrappedLines[destLineIndex].replaceCells(destCol, newCols, fillCharData);
|
||||||
|
|
||||||
// Work backwards and remove any rows at the end that only contain null cells
|
|
||||||
let countToRemove = 0;
|
|
||||||
for (let i = wrappedLines.length - 1; i > 0; i--) {
|
|
||||||
if (wrappedLines[i].getTrimmedLength() === 0) {
|
|
||||||
countToRemove++;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove rows and adjust cursor
|
// Remove rows and adjust cursor
|
||||||
|
const countToRemove = wrappedLines.length - destLineIndex - 1;
|
||||||
if (countToRemove > 0) {
|
if (countToRemove > 0) {
|
||||||
this.lines.splice(y + wrappedLines.length - countToRemove, countToRemove);
|
this.lines.splice(y + wrappedLines.length - countToRemove, countToRemove);
|
||||||
let removing = countToRemove;
|
let removing = countToRemove;
|
||||||
|
|||||||
+3
-3
@@ -228,8 +228,8 @@ export class BufferLine implements IBufferLine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public resize(cols: number, fillCharData: CharData, shrink: boolean = false): void {
|
public resize(cols: number, fillCharData: CharData): void {
|
||||||
if (cols === this.length || (!shrink && cols < this.length)) {
|
if (cols === this.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cols > this.length) {
|
if (cols > this.length) {
|
||||||
@@ -245,7 +245,7 @@ export class BufferLine implements IBufferLine {
|
|||||||
for (let i = this.length; i < cols; ++i) {
|
for (let i = this.length; i < cols; ++i) {
|
||||||
this.set(i, fillCharData);
|
this.set(i, fillCharData);
|
||||||
}
|
}
|
||||||
} else if (shrink) {
|
} else {
|
||||||
if (cols) {
|
if (cols) {
|
||||||
const data = new Uint32Array(cols * CELL_SIZE);
|
const data = new Uint32Array(cols * CELL_SIZE);
|
||||||
data.set(this._data.subarray(0, cols * CELL_SIZE));
|
data.set(this._data.subarray(0, cols * CELL_SIZE));
|
||||||
|
|||||||
Reference in New Issue
Block a user