diff --git a/src/Buffer.ts b/src/Buffer.ts index 143e2b2b..41a76ccc 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -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); + } + } } } diff --git a/src/Types.ts b/src/Types.ts index b1fea903..d7715f81 100644 --- a/src/Types.ts +++ b/src/Types.ts @@ -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;