mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-25 02:08:59 +00:00
fix eaw test. comment.
This commit is contained in:
parent
c73fee2f7d
commit
620c17c7dc
@ -106,6 +106,10 @@
|
||||
var stringFromCharCode = String.fromCharCode;
|
||||
var floor = Math.floor;
|
||||
|
||||
/**
|
||||
* Wide, Surrogates, and Combining
|
||||
*/
|
||||
|
||||
exports.charWidth = function(str, i) {
|
||||
var point = typeof str !== 'number'
|
||||
? exports.codePointAt(str, i || 0)
|
||||
@ -447,21 +451,9 @@ exports.isNonSpacing = function(str, i) {
|
||||
return exports.combining[point] === true;
|
||||
};
|
||||
|
||||
/*
|
||||
exports.codePointAt = function(str, position) {
|
||||
position = +position || 0;
|
||||
var x = str.charCodeAt(position);
|
||||
var y = str.length > 1 ? str.charCodeAt(position + 1) : 0;
|
||||
var point = x;
|
||||
if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
|
||||
x &= 0x3FF;
|
||||
y &= 0x3FF;
|
||||
point = (x << 10) | y;
|
||||
point += 0x10000;
|
||||
}
|
||||
return point;
|
||||
};
|
||||
*/
|
||||
/**
|
||||
* Code Point Helpers
|
||||
*/
|
||||
|
||||
exports.codePointAt = function(str, position) {
|
||||
if (str == null) {
|
||||
@ -494,6 +486,20 @@ exports.codePointAt = function(str, position) {
|
||||
return first;
|
||||
};
|
||||
|
||||
// exports.codePointAt = function(str, position) {
|
||||
// position = +position || 0;
|
||||
// var x = str.charCodeAt(position);
|
||||
// var y = str.length > 1 ? str.charCodeAt(position + 1) : 0;
|
||||
// var point = x;
|
||||
// if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
|
||||
// x &= 0x3FF;
|
||||
// y &= 0x3FF;
|
||||
// point = (x << 10) | y;
|
||||
// point += 0x10000;
|
||||
// }
|
||||
// return point;
|
||||
// };
|
||||
|
||||
exports.fromCodePoint = function() {
|
||||
var MAX_SIZE = 0x4000;
|
||||
var codeUnits = [];
|
||||
|
@ -2432,6 +2432,7 @@ Element.prototype.parseContent = function(noTags) {
|
||||
// NOTE: We could drop this, the non-surrogates would get changed to ? by
|
||||
// the unicode filter, and surrogates changed to ? by the surrogate
|
||||
// regex. however, the user might expect them to be 0-width.
|
||||
// NOTE: Might be better for performance to drop!
|
||||
content = content.replace(unicode.chars.combining, '');
|
||||
// no surrogate pairs: replace them with question-marks.
|
||||
content = content.replace(unicode.chars.surrogate, '?');
|
||||
|
@ -101,7 +101,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')) {
|
||||
if (!~process.argv.indexOf('vte')) {
|
||||
lorem = lorem.replace(/a/gi, SURROGATE_DOUBLE);
|
||||
}
|
||||
lorem = lorem.replace(/o/gi, SURROGATE_SINGLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user