clean up Element.render surrogate handling.

This commit is contained in:
Christopher Jeffrey 2015-04-16 13:11:29 -07:00
parent 0acae98979
commit 489aa2dbe3
1 changed files with 4 additions and 12 deletions

View File

@ -4011,9 +4011,9 @@ Element.prototype.render = function() {
} }
if (this.screen.fullUnicode && content[ci - 1]) { if (this.screen.fullUnicode && content[ci - 1]) {
var point = unicode.codePointAt(content, ci - 1);
// Handle combining chars: // Handle combining chars:
// Make sure they get in the same cell and are counted as 0. // 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 (unicode.combining[point]) {
if (point > 0x00ffff) { if (point > 0x00ffff) {
ch = content[ci - 1] + content[ci]; ch = content[ci - 1] + content[ci];
@ -4029,17 +4029,9 @@ Element.prototype.render = function() {
} }
// Handle surrogate pairs: // Handle surrogate pairs:
// Make sure we put surrogate pair chars in one cell. // Make sure we put surrogate pair chars in one cell.
var code = content[ci - 1].charCodeAt(0); if (point > 0x00ffff) {
// 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]; ch = content[ci - 1] + content[ci];
ci++; ci++;
} else {
ch = bch;
}
} }
} }