Issue #245: Blank screen in Chrome 31.0.1650.57

Applied patch and fixed some formating.

Patch: https://code.google.com/p/shellinabox/issues/detail?id=245#c5
This commit is contained in:
KLuka 2015-03-05 16:15:12 +01:00
parent 618999f3cc
commit 33813cd46d

View file

@ -175,7 +175,7 @@ function VT100(container) {
}
this.getUserSettings();
this.initializeElements(container);
this.maxScrollbackLines = 500;
this.maxScrollbackLines = 2000;
this.npar = 0;
this.par = [ ];
this.isQuestionMark = false;
@ -1157,8 +1157,12 @@ VT100.prototype.resizer = function() {
// still get confused if somebody enters a character that is wider/narrower
// than normal. This can happen if the browser tries to substitute a
// characters from a different font.
this.cursor.style.width = this.cursorWidth + 'px';
this.cursor.style.height = this.cursorHeight + 'px';
if (this.cursorWidth > 0) {
this.cursor.style.width = this.cursorWidth + 'px';
}
if (this.cursorHeight > 0) {
this.cursor.style.height = this.cursorHeight + 'px';
}
// Adjust height for one pixel padding of the #vt100 element.
// The latter is necessary to properly display the inactive cursor.
@ -1531,8 +1535,20 @@ VT100.prototype.insertBlankLine = function(y, color, style) {
};
VT100.prototype.updateWidth = function() {
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/
this.cursorWidth*this.scale);
// if the cursorWidth is zero, something is wrong. Try to get it some other way.
if (this.cursorWidth <= 0) {
if (this.cursor.clientWidth <= 0) {
// Rats, this.cursor.clientWidth is zero too. Best guess?
this.terminalWidth = 80;
} else {
// update the size.
this.cursorWidth = this.cursor.clientWidth;
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
}
} else {
this.terminalWidth = Math.floor(this.console[this.currentScreen].offsetWidth/this.cursorWidth*this.scale);
}
return this.terminalWidth;
};