fix error caused when screen.render() is called during a delayed resize.

This commit is contained in:
Christopher Jeffrey 2015-02-13 00:59:47 -08:00
parent 41cb97d664
commit c0e36f137d

View File

@ -660,7 +660,11 @@ Screen.prototype.render = function() {
});
this._ci = -1;
this.draw(0, this.rows - 1);
// Cannot use this.rows here because of the resize delay:
// `rows` and `cols` get set instantly by the resize, but `alloc` has a 300ms
// delay before the new cells are added, which will sometimes throw. Measure
// by lines.
this.draw(0, this.lines.length - 1);
// XXX Workaround to deal with cursor pos before the screen has rendered and
// lpos is not reliable (stale).
@ -908,7 +912,11 @@ Screen.prototype.draw = function(start, end) {
out = '';
attr = this.dattr;
for (x = 0; x < this.cols; x++) {
// Cannot use this.cols here because of the resize delay:
// `rows` and `cols` get set instantly by the resize, but `alloc` has a
// 300ms delay before the new cells are added, which will sometimes throw.
// Measure by line length.
for (x = 0; x < line.length; x++) {
data = line[x][0];
ch = line[x][1];