Merge pull request #520 from Tyriar/519_erase_null_check
Add null checks in eraseRight and eraseLeft
This commit is contained in:
+13
-10
@@ -2159,14 +2159,14 @@ Terminal.prototype.nextStop = function(x) {
|
|||||||
* @param {number} y The line in which to operate.
|
* @param {number} y The line in which to operate.
|
||||||
*/
|
*/
|
||||||
Terminal.prototype.eraseRight = function(x, y) {
|
Terminal.prototype.eraseRight = function(x, y) {
|
||||||
var line = this.lines.get(this.ybase + y)
|
var line = this.lines.get(this.ybase + y);
|
||||||
, ch = [this.eraseAttr(), ' ', 1]; // xterm
|
if (!line) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ch = [this.eraseAttr(), ' ', 1]; // xterm
|
||||||
for (; x < this.cols; x++) {
|
for (; x < this.cols; x++) {
|
||||||
line[x] = ch;
|
line[x] = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateRange(y);
|
this.updateRange(y);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2178,12 +2178,15 @@ Terminal.prototype.eraseRight = function(x, y) {
|
|||||||
* @param {number} y The line in which to operate.
|
* @param {number} y The line in which to operate.
|
||||||
*/
|
*/
|
||||||
Terminal.prototype.eraseLeft = function(x, y) {
|
Terminal.prototype.eraseLeft = function(x, y) {
|
||||||
var line = this.lines.get(this.ybase + y)
|
var line = this.lines.get(this.ybase + y);
|
||||||
, ch = [this.eraseAttr(), ' ', 1]; // xterm
|
if (!line) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ch = [this.eraseAttr(), ' ', 1]; // xterm
|
||||||
x++;
|
x++;
|
||||||
while (x--) line[x] = ch;
|
while (x--) {
|
||||||
|
line[x] = ch;
|
||||||
|
}
|
||||||
this.updateRange(y);
|
this.updateRange(y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user