handle 0-width surrogates.
This commit is contained in:
parent
cb363c575b
commit
62b1003a05
|
@ -2673,7 +2673,10 @@ main:
|
||||||
var surrogates = out[i].match(/[\ud800-\udbff][\udc00-\udfff]/g);
|
var surrogates = out[i].match(/[\ud800-\udbff][\udc00-\udfff]/g);
|
||||||
if (surrogates && surrogates.length) {
|
if (surrogates && surrogates.length) {
|
||||||
for (var j = 0; j < surrogates.length; j++) {
|
for (var j = 0; j < surrogates.length; j++) {
|
||||||
if (east_asian_width.char_width(surrogates[j].codePointAt(0)) === 1) {
|
var cwid = east_asian_width.char_width(surrogates[j].codePointAt(0));
|
||||||
|
if (cwid === 0) {
|
||||||
|
out[i] += ' ';
|
||||||
|
} else if (cwid === 1) {
|
||||||
out[i] += ' ';
|
out[i] += ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue