mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-03 22:55:43 +00:00
fix eaw test. comment.
This commit is contained in:
parent
c73fee2f7d
commit
620c17c7dc
@ -106,6 +106,10 @@
|
|||||||
var stringFromCharCode = String.fromCharCode;
|
var stringFromCharCode = String.fromCharCode;
|
||||||
var floor = Math.floor;
|
var floor = Math.floor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wide, Surrogates, and Combining
|
||||||
|
*/
|
||||||
|
|
||||||
exports.charWidth = function(str, i) {
|
exports.charWidth = function(str, i) {
|
||||||
var point = typeof str !== 'number'
|
var point = typeof str !== 'number'
|
||||||
? exports.codePointAt(str, i || 0)
|
? exports.codePointAt(str, i || 0)
|
||||||
@ -447,21 +451,9 @@ exports.isNonSpacing = function(str, i) {
|
|||||||
return exports.combining[point] === true;
|
return exports.combining[point] === true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
exports.codePointAt = function(str, position) {
|
* Code Point Helpers
|
||||||
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.codePointAt = function(str, position) {
|
exports.codePointAt = function(str, position) {
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
@ -494,6 +486,20 @@ exports.codePointAt = function(str, position) {
|
|||||||
return first;
|
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() {
|
exports.fromCodePoint = function() {
|
||||||
var MAX_SIZE = 0x4000;
|
var MAX_SIZE = 0x4000;
|
||||||
var codeUnits = [];
|
var codeUnits = [];
|
||||||
|
@ -2432,6 +2432,7 @@ Element.prototype.parseContent = function(noTags) {
|
|||||||
// 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
|
||||||
// regex. however, the user might expect them to be 0-width.
|
// 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, '');
|
content = content.replace(unicode.chars.combining, '');
|
||||||
// no surrogate pairs: replace them with question-marks.
|
// no surrogate pairs: replace them with question-marks.
|
||||||
content = content.replace(unicode.chars.surrogate, '?');
|
content = content.replace(unicode.chars.surrogate, '?');
|
||||||
|
@ -101,7 +101,7 @@ lorem = lorem.replace(/e/gi, DOUBLE);
|
|||||||
//lorem = lorem.replace(/r/gi, JUAN);
|
//lorem = lorem.replace(/r/gi, JUAN);
|
||||||
// NOTE: libvte breaks when trying to display
|
// NOTE: libvte breaks when trying to display
|
||||||
// this surrogate pair double width character:
|
// 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(/a/gi, SURROGATE_DOUBLE);
|
||||||
}
|
}
|
||||||
lorem = lorem.replace(/o/gi, SURROGATE_SINGLE);
|
lorem = lorem.replace(/o/gi, SURROGATE_SINGLE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user