mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-09 18:45:51 +00:00
avoid wrapping shortfall due to surrogate pairs.
This commit is contained in:
parent
092b240ef6
commit
ba4108445a
@ -2846,6 +2846,17 @@ main:
|
|||||||
} else {
|
} else {
|
||||||
// Try to find a character to break on.
|
// Try to find a character to break on.
|
||||||
if (i !== line.length) {
|
if (i !== line.length) {
|
||||||
|
// <XXX>
|
||||||
|
// Compensate for surrogate length
|
||||||
|
// counts on wrapping (experimental):
|
||||||
|
// NOTE: Could optimize this by putting
|
||||||
|
// it in the parent for loop.
|
||||||
|
if (unicode.isSurrogate(line, i)) i--;
|
||||||
|
for (var s = 0, n = 0; n < i; n++) {
|
||||||
|
if (unicode.isSurrogate(line, n)) s++, n++;
|
||||||
|
}
|
||||||
|
i += s;
|
||||||
|
// </XXX>
|
||||||
j = i;
|
j = i;
|
||||||
// Break _past_ space.
|
// Break _past_ space.
|
||||||
// Break _past_ double-width chars.
|
// Break _past_ double-width chars.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user