move erase methods to InputHandler

This commit is contained in:
Jörg Breitbart
2018-08-30 18:10:18 +02:00
parent a1421b151e
commit 276e65fa0b
4 changed files with 74 additions and 50 deletions
-39
View File
@@ -1709,36 +1709,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this._refreshEnd = this.rows - 1;
}
/**
* Erase in the identified line everything from "x" to the end of the line (right).
* @param x The column from which to start erasing to the end of the line.
* @param y The line in which to operate.
*/
// 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;
}
line.replaceCells(x, this.cols, [this.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
this.updateRange(y);
}
/**
* Erase in the identified line everything from "x" to the start of the line (left).
* @param x The column from which to start erasing to the start of the line.
* @param y The line in which to operate.
*/
// 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;
}
line.replaceCells(0, x + 1, [this.eraseAttr(), NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
this.updateRange(y);
}
/**
* Clear the entire buffer, making the prompt line the new first line.
*/
@@ -1759,15 +1729,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this.emit('scroll', this.buffer.ydisp);
}
/**
* Erase all content in the given line
* @param y The line to erase all of its contents.
*/
// FIXME: decide whether to remove from Terminal
public eraseLine(y: number): void {
this.eraseRight(0, y);
}
/**
* If cur return the back color xterm feature attribute. Else return default attribute.
* @param cur