diff --git a/lib/widget.js b/lib/widget.js index 3ba9e8f..2d41e03 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -2321,20 +2321,6 @@ Element.prototype.parseContent = function(noTags) { .replace(/\r\n|\r/g, '\n') .replace(/\t/g, this.screen.tabc); - if (this.screen.options.doubleWidth - && (this.screen.tput.unicode - || this.screen.tput.numbers.U8 === 1)) { - // double-width chars will eat the next char after render - create a - // blank character after it so it doesn't eat the real next char - content = content.replace(wideChars, '$1 '); - } else { - // no double-width. replace double-width chars with question-marks. - // NOTE: could use two chars: '? ' depending on what is intended. - // if we did, we could remove the unicode checks above in this if - // statement. - content = content.replace(wideChars, '?'); - } - if (!noTags) { content = this._parseTags(content); } @@ -2552,6 +2538,20 @@ Element.prototype._wrapContent = function(content, width) { , lines , rest; + if (this.screen.options.doubleWidth + && (this.screen.tput.unicode + || this.screen.tput.numbers.U8 === 1)) { + // double-width chars will eat the next char after render - create a + // blank character after it so it doesn't eat the real next char + content = content.replace(wideChars, '$1 '); + } else { + // no double-width. replace double-width chars with question-marks. + // NOTE: could use two chars: '? ' depending on what is intended. + // if we did, we could remove the unicode checks above in this if + // statement. + content = content.replace(wideChars, '?'); + } + lines = content.split('\n'); if (!content) {