diff --git a/lib/widget.js b/lib/widget.js index 5d2832e..3de83ad 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -891,7 +891,9 @@ Screen.prototype.draw = function(start, end) { // If there's more than 10 spaces, use EL regardless // and start over drawing the rest of line. Might - // not be worth it. + // not be worth it. Try to use ECH if the terminal + // supports it. Maybe only try to use ECH here. + // //if (this.tput && this.tput.strings.erase_chars) // if (!clr && neq && (xx - x) > 10) { // lx = ly = -1; // if (data !== attr) { @@ -901,37 +903,40 @@ Screen.prototype.draw = function(start, end) { // out += this.tput // ? this.tput.cup(y, x) // : '\x1b[' + (y + 1) + ';' + (x + 1) + 'H'; - // out += this.tput - // ? this.tput.el(0) - // : '\x1b[K'; + // if (this.tput && this.tput.strings.erase_chars) { + // // Use erase_chars to avoid erasing the whole line. + // out += this.tput + // ? this.tput.ech(xx - x) + // : '\x1b[' + (xx - x) + 'X'; + // } else { + // out += this.tput + // ? this.tput.el(0) + // : '\x1b[K'; + // } // out += this.tput // ? this.tput.cuf(xx - x) // : '\x1b[' + (xx - x) + 'C'; - // clr = xx; // tmp - // for (xx = x; xx < this.cols; xx++) { - // o[xx][0] = data; - // o[xx][1] = ' '; - // } - // x = clr - 1; + // this.fillRegion(data, ' ', + // x, this.tput && this.tput.strings.erase_chars ? xx : this.cols, + // y, y); + // x = xx - 1; // continue; // } // Skip to the next line if the // rest of the line is already drawn. - // Comment the break in the first - // xx loop above for this to work. - // Which carries less overhead? - // OR use another for loop: - // for (xx = x; xx < this.cols; xx++) { - // if (line[xx][0] !== o[xx][0] || line[xx][1] !== o[xx][1]) { - // neq = true; + // if (!neq) { + // for (; xx < this.cols; xx++) { + // if (line[xx][0] !== o[xx][0] || line[xx][1] !== o[xx][1]) { + // neq = true; + // break; + // } + // } + // if (!neq) { + // attr = data; // break; // } // } - // if (!neq) { - // attr = data; - // break; - // } } // Optimize by comparing the real output