diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 6c72e6a4..b6883a0f 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -749,20 +749,26 @@ export class InputHandler extends Disposable implements IInputHandler { j = this._terminal.buffer.y; this._terminal.updateRange(j); this._eraseInBufferLine(j++, this._terminal.buffer.x, this._terminal.cols); - for (; j < this._terminal.rows; j++) this._eraseInBufferLine(j, 0, this._terminal.cols); + for (; j < this._terminal.rows; j++) { + this._eraseInBufferLine(j, 0, this._terminal.cols); + } this._terminal.updateRange(j); break; case 1: j = this._terminal.buffer.y; this._terminal.updateRange(j); this._eraseInBufferLine(j, 0, this._terminal.buffer.x + 1); - while (j--) this._eraseInBufferLine(j, 0, this._terminal.cols); + while (j--) { + this._eraseInBufferLine(j, 0, this._terminal.cols); + } this._terminal.updateRange(0); break; case 2: j = this._terminal.rows; this._terminal.updateRange(j - 1); - while (j--) this._eraseInBufferLine(j, 0, this._terminal.cols); + while (j--) { + this._eraseInBufferLine(j, 0, this._terminal.cols); + } this._terminal.updateRange(0); break; case 3: diff --git a/src/Terminal.ts b/src/Terminal.ts index e5e3c755..9f800b37 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -1716,7 +1716,9 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II // FIXME: decide whether to remove from Terminal public eraseRight(x: number, y: number): void { const line = this.buffer.lines.get(this.buffer.ybase + y); - if (!line) return; + if (!line) { + return; + } line.replaceCells(x, this.cols, [this.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]); this.updateRange(y); } @@ -1729,7 +1731,9 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II // FIXME: decide whether to remove from Terminal public eraseLeft(x: number, y: number): void { const line = this.buffer.lines.get(this.buffer.ybase + y); - if (!line) return; + if (!line) { + return; + } line.replaceCells(0, x + 1, [this.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]); this.updateRange(y); } diff --git a/src/TerminalLine.ts b/src/TerminalLine.ts index 186e2f58..77f3962e 100644 --- a/src/TerminalLine.ts +++ b/src/TerminalLine.ts @@ -34,10 +34,16 @@ export class TerminalLine { this._data = []; this.length = this._data.length; if (cols) { - if (!ch) ch = TerminalLine.defaultCell; - for (let i = 0; i < cols; i++) this.push(ch); // Note: the ctor ch is not cloned + if (!ch) { + ch = TerminalLine.defaultCell; + } + for (let i = 0; i < cols; i++) { + this.push(ch); // Note: the ctor ch is not cloned + } + } + if (isWrapped) { + this.isWrapped = true; } - if (isWrapped) this.isWrapped = true; } public get(index: number): CharData { @@ -98,6 +104,8 @@ export class TerminalLine { /** replace cells from pos to pos + n - 1 with fill */ public replaceCells(start: number, end: number, fill: CharData): void { - while (start < end && start < this.length) this.set(start++, fill); // Note: fill is not cloned + while (start < end && start < this.length) { + this.set(start++, fill); // Note: fill is not cloned + } } }