From 489aa2dbe3783798fb61e82e7926a8cf328474ee Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 16 Apr 2015 13:11:29 -0700 Subject: [PATCH] clean up Element.render surrogate handling. --- lib/widget.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index 9b93bad..566aa59 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -4011,9 +4011,9 @@ Element.prototype.render = function() { } if (this.screen.fullUnicode && content[ci - 1]) { + var point = unicode.codePointAt(content, ci - 1); // Handle combining chars: // Make sure they get in the same cell and are counted as 0. - var point = unicode.codePointAt(content, ci - 1); if (unicode.combining[point]) { if (point > 0x00ffff) { ch = content[ci - 1] + content[ci]; @@ -4029,17 +4029,9 @@ Element.prototype.render = function() { } // Handle surrogate pairs: // Make sure we put surrogate pair chars in one cell. - var code = content[ci - 1].charCodeAt(0); - // if (unicode.codePointAt(content, ci - 1) > 0x00ffff) { - // if (unicode.isSurrogate(content, ci - 1) { - if (code >= 0xd800 && code <= 0xdbff) { - var code2 = (content[ci] || '').charCodeAt(0); - if (code2 >= 0xdc00 && code2 <= 0xdfff) { - ch = content[ci - 1] + content[ci]; - ci++; - } else { - ch = bch; - } + if (point > 0x00ffff) { + ch = content[ci - 1] + content[ci]; + ci++; } }