workaround VTEs wide surrogate pair display bug.

This commit is contained in:
Christopher Jeffrey 2015-04-26 07:03:52 -07:00
parent b753a8c492
commit 051e90070c
2 changed files with 9 additions and 0 deletions

View File

@ -2425,6 +2425,14 @@ Element.prototype.parseContent = function(noTags) {
// 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(unicode.chars.wide, '$1\x03');
// VTE cannot display double-width chars that are also
// surrogate pairs: It miscalculates the width of the chars.
if (this.screen.program.isVTE) {
// In reality we should only drop double-width surrogate pairs,
// but we don't have a regex for that yet.
// content = content.replace(unicode.chars.surrogateDoubleWidth, '?');
content = content.replace(unicode.chars.surrogate, '?');
}
} else {
// no double-width: replace them with question-marks.
content = content.replace(unicode.chars.all, '??');

View File

@ -93,6 +93,7 @@ lorem = lorem.replace(/e/gi, DOUBLE);
//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);
}