mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-11 03:25:45 +00:00
add regex for all wide chars.
This commit is contained in:
parent
758eef133c
commit
ccca1092e7
@ -549,6 +549,16 @@ exports.wideChars = new RegExp('(['
|
|||||||
+ '\\uffe0-\\uffe6'
|
+ '\\uffe0-\\uffe6'
|
||||||
+ '])', 'g');
|
+ '])', 'g');
|
||||||
|
|
||||||
|
exports.allWide = new RegExp('('
|
||||||
|
// 0x20000 - 0x2fffd:
|
||||||
|
+ '[\\ud840-\\ud87f][\\udc00-\\udffd]'
|
||||||
|
+ '|'
|
||||||
|
// 0x30000 - 0x3fffd:
|
||||||
|
+ '[\\ud880-\\ud8bf][\\udc00-\\udffd]'
|
||||||
|
+ '|'
|
||||||
|
+ exports.wideChars.source.slice(1, -1)
|
||||||
|
+ ')', 'g');
|
||||||
|
|
||||||
// Regex to detect a surrogate pair.
|
// Regex to detect a surrogate pair.
|
||||||
exports.surrogate = /[\ud800-\udbff][\udc00-\udfff]/g;
|
exports.surrogate = /[\ud800-\udbff][\udc00-\udfff]/g;
|
||||||
|
|
||||||
|
@ -2427,7 +2427,7 @@ Element.prototype.parseContent = function(noTags) {
|
|||||||
content = content.replace(unicode.wideChars, '$1_');
|
content = content.replace(unicode.wideChars, '$1_');
|
||||||
} else {
|
} else {
|
||||||
// no double-width: replace them with question-marks.
|
// no double-width: replace them with question-marks.
|
||||||
content = content.replace(unicode.wideChars, '??');
|
content = content.replace(unicode.allWide, '??');
|
||||||
// delete combining characters since they're 0-width anyway.
|
// delete combining characters since they're 0-width anyway.
|
||||||
// NOTE: We could drop this, the non-surrogates would get changed to ? by
|
// NOTE: We could drop this, the non-surrogates would get changed to ? by
|
||||||
// the unicode filter, and surrogates changed to ? by the surrogate
|
// the unicode filter, and surrogates changed to ? by the surrogate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user