diff --git a/lib/widget.js b/lib/widget.js index c8c6095..fc7506b 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -983,9 +983,7 @@ Screen.prototype.draw = function(start, end) { , attr , fg , bg - , flags - , cwid - , point; + , flags; var main = '' , pre @@ -1114,9 +1112,6 @@ Screen.prototype.draw = function(start, end) { // Optimize by comparing the real output // buffer to the pending output buffer. if (data === o[x][0] && ch === o[x][1]) { - // if (unicode.charWidth(ch, 0) === 2) { - // x++; - // } if (lx === -1) { lx = x; ly = y; @@ -1208,9 +1203,7 @@ Screen.prototype.draw = function(start, end) { if (this.fullUnicode) { // If this is a surrogate pair double-width char, we can ignore it // because parseContent already counted it as length=2. - point = unicode.codePointAt(line[x][1], 0); - cwid = unicode.charWidth(point); - if (cwid === 2) { + if (unicode.charWidth(line[x][1]) === 2) { // Might also need: `line[x + 1][0] !== line[x][0]` // for borderless boxes? if (x === line.length - 1 || angles[line[x + 1][1]]) { @@ -2033,9 +2026,7 @@ Screen.prototype.screenshot = function(xi, xl, yi, yl, term) { , out , ch , data - , attr - , cwid - , point; + , attr; var sdattr = this.dattr; @@ -2076,9 +2067,7 @@ Screen.prototype.screenshot = function(xi, xl, yi, yl, term) { } if (this.fullUnicode) { - point = unicode.codePointAt(line[x][1], 0); - cwid = unicode.charWidth(point); - if (cwid === 2) { + if (unicode.charWidth(line[x][1]) === 2) { if (x === xl - 1) { ch = ' '; } else { @@ -2469,7 +2458,6 @@ Element.prototype.parseContent = function(noTags) { }; Element.prototype.textLength = function(text) { - // return unicode.strWidth(text); if (!this.parseTags) return text.length; return text .replace(/{(\/?)([\w\-,;!#]*)}/g, '') @@ -4150,19 +4138,6 @@ Element.prototype.render = function() { } } - // Alternative to regex to avoiding combining chars when fullUnicode=false - // NOTE: Wouldn't matter because the surrogate regex would already remove it. - // if (!this.screen.fullUnicode) { - // var point = unicode.codePointAt(content, ci - 1); - // if (unicode.combining[point]) { - // if (point > 0x00ffff) { - // ci++; - // } - // x--; - // continue; - // } - // } - if (this.style.transparent) { lines[y][x][0] = blend(attr, lines[y][x][0]); if (content[ci]) lines[y][x][1] = ch; diff --git a/test/widget-eaw.js b/test/widget-eaw.js index 854bd1d..db59037 100644 --- a/test/widget-eaw.js +++ b/test/widget-eaw.js @@ -95,12 +95,7 @@ var lorem = 'Non eram nes' + (!~process.argv.indexOf('s') ? COMBINE : '') lorem = lorem.replace(/e/gi, DOUBLE); //lorem = lorem.replace(/e/gi, DU); //lorem = lorem.replace(/r/gi, JUAN); -// NOTE: libvte breaks when trying to display -// this surrogate pair double width character: -// if (!~process.argv.indexOf('vte') && !screen.program.isVTE) { -if (!~process.argv.indexOf('vte')) { - lorem = lorem.replace(/a/gi, SURROGATE_DOUBLE); -} +lorem = lorem.replace(/a/gi, SURROGATE_DOUBLE); lorem = lorem.replace(/o/gi, SURROGATE_SINGLE); if (~process.argv.indexOf('s')) { lorem = lorem.replace(/s/gi, 's' + COMBINE);