fix VTE. only remove surrogate double chars.

This commit is contained in:
Christopher Jeffrey 2015-04-26 07:16:50 -07:00
parent 051e90070c
commit 0ea8c77dd8
2 changed files with 8 additions and 6 deletions

View File

@ -567,13 +567,18 @@ exports.chars.wide = new RegExp('(['
+ '\\uffe0-\\uffe6' + '\\uffe0-\\uffe6'
+ '])', 'g'); + '])', 'g');
// All wide chars including surrogate pairs. // All surrogate pair wide chars.
exports.chars.all = new RegExp('(' exports.chars.swide = new RegExp('('
// 0x20000 - 0x2fffd: // 0x20000 - 0x2fffd:
+ '[\\ud840-\\ud87f][\\udc00-\\udffd]' + '[\\ud840-\\ud87f][\\udc00-\\udffd]'
+ '|' + '|'
// 0x30000 - 0x3fffd: // 0x30000 - 0x3fffd:
+ '[\\ud880-\\ud8bf][\\udc00-\\udffd]' + '[\\ud880-\\ud8bf][\\udc00-\\udffd]'
+ ')', 'g');
// All wide chars including surrogate pairs.
exports.chars.all = new RegExp('('
+ exports.chars.swide.source.slice(1, -1)
+ '|' + '|'
+ exports.chars.wide.source.slice(1, -1) + exports.chars.wide.source.slice(1, -1)
+ ')', 'g'); + ')', 'g');

View File

@ -2428,10 +2428,7 @@ Element.prototype.parseContent = function(noTags) {
// VTE cannot display double-width chars that are also // VTE cannot display double-width chars that are also
// surrogate pairs: It miscalculates the width of the chars. // surrogate pairs: It miscalculates the width of the chars.
if (this.screen.program.isVTE) { if (this.screen.program.isVTE) {
// In reality we should only drop double-width surrogate pairs, content = content.replace(unicode.chars.swide, '?');
// but we don't have a regex for that yet.
// content = content.replace(unicode.chars.surrogateDoubleWidth, '?');
content = content.replace(unicode.chars.surrogate, '?');
} }
} else { } else {
// no double-width: replace them with question-marks. // no double-width: replace them with question-marks.