deal with bad csr's. improve example. readme.
This commit is contained in:
+11
-7
@@ -822,9 +822,9 @@ Terminal.prototype.bindMouse = function() {
|
||||
// be sure to avoid sending
|
||||
// bad positions to the program
|
||||
if (x < 0) x = 0;
|
||||
if (x >= self.cols) x = self.cols - 1;
|
||||
if (x > self.cols) x = self.cols;
|
||||
if (y < 0) y = 0;
|
||||
if (y >= self.rows) y = self.rows - 1;
|
||||
if (y > self.rows) y = self.rows;
|
||||
|
||||
// xterm sends raw bytes and
|
||||
// starts at 32 (SP) for each.
|
||||
@@ -909,6 +909,9 @@ Terminal.prototype.destroy = function() {
|
||||
this._events = {};
|
||||
this.handler = function() {};
|
||||
this.write = function() {};
|
||||
if (this.element.parentNode) {
|
||||
this.element.parentNode.removeChild(this.element);
|
||||
}
|
||||
//this.emit('close');
|
||||
};
|
||||
|
||||
@@ -950,9 +953,10 @@ Terminal.prototype.refresh = function(start, end) {
|
||||
width = this.cols;
|
||||
y = start;
|
||||
|
||||
// if (end > this.lines.length) {
|
||||
// end = this.lines.length;
|
||||
// }
|
||||
if (end >= this.lines.length) {
|
||||
this.log('`end` is too large. Most likely a bad CSR.');
|
||||
end = this.lines.length - 1;
|
||||
}
|
||||
|
||||
for (; y <= end; y++) {
|
||||
row = y + this.ydisp;
|
||||
@@ -984,7 +988,7 @@ Terminal.prototype.refresh = function(start, end) {
|
||||
}
|
||||
if (data !== this.defAttr) {
|
||||
if (data === -1) {
|
||||
out += '<span class="reverse-video">';
|
||||
out += '<span class="reverse-video terminal-cursor">';
|
||||
} else {
|
||||
out += '<span style="';
|
||||
|
||||
@@ -996,7 +1000,7 @@ Terminal.prototype.refresh = function(start, end) {
|
||||
if (!Terminal.brokenBold) {
|
||||
out += 'font-weight:bold;';
|
||||
}
|
||||
// see: XTerm*boldColors
|
||||
// See: XTerm*boldColors
|
||||
if (fgColor < 8) fgColor += 8;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user