Properly shrink rows to cols every time

This commit is contained in:
Daniel Imms
2018-12-28 12:57:10 -08:00
parent 358898daf9
commit a33e8a6af7
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -162,7 +162,7 @@ export class Buffer implements IBuffer {
// The following adjustments should only happen if the buffer has been
// initialized/filled.
if (this.lines.length > 0) {
// Deal with columns increasing (we don't do anything when columns reduce)
// Deal with columns increasing (reducing needs to happen after reflow)
if (this._terminal.cols < newCols) {
const ch: CharData = [DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]; // does xterm use the default attr?
for (let i = 0; i < this.lines.length; i++) {
@@ -236,6 +236,12 @@ export class Buffer implements IBuffer {
if (this._terminal.options.experimentalBufferLineImpl === 'TypedArray') {
this._reflow(newCols);
if (this._terminal.cols > newCols) {
for (let i = 0; i < this.lines.length; i++) {
this.lines.get(i).resize(newCols, null);
}
}
}
}
+1 -1
View File
@@ -521,7 +521,7 @@ export interface IBufferLine {
insertCells(pos: number, n: number, ch: CharData): void;
deleteCells(pos: number, n: number, fill: CharData): void;
replaceCells(start: number, end: number, fill: CharData): void;
resize(cols: number, fill: CharData, shrink?: boolean): void;
resize(cols: number, fill: CharData): void;
fill(fillCharData: CharData): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;