mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
set conditional blocks in brackets
This commit is contained in:
+9
-3
@@ -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:
|
||||
|
||||
+6
-2
@@ -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);
|
||||
}
|
||||
|
||||
+12
-4
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user