move wideChar handling to _wrapContent.

This commit is contained in:
Christopher Jeffrey 2015-04-14 15:43:37 -07:00
parent ecf9e38f55
commit 307b757e1f
1 changed files with 14 additions and 14 deletions

View File

@ -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) {