clean up unicode code and comments some more.
This commit is contained in:
parent
f8946a22f3
commit
09fe097d3f
|
@ -983,9 +983,7 @@ Screen.prototype.draw = function(start, end) {
|
||||||
, attr
|
, attr
|
||||||
, fg
|
, fg
|
||||||
, bg
|
, bg
|
||||||
, flags
|
, flags;
|
||||||
, cwid
|
|
||||||
, point;
|
|
||||||
|
|
||||||
var main = ''
|
var main = ''
|
||||||
, pre
|
, pre
|
||||||
|
@ -1114,9 +1112,6 @@ Screen.prototype.draw = function(start, end) {
|
||||||
// Optimize by comparing the real output
|
// Optimize by comparing the real output
|
||||||
// buffer to the pending output buffer.
|
// buffer to the pending output buffer.
|
||||||
if (data === o[x][0] && ch === o[x][1]) {
|
if (data === o[x][0] && ch === o[x][1]) {
|
||||||
// if (unicode.charWidth(ch, 0) === 2) {
|
|
||||||
// x++;
|
|
||||||
// }
|
|
||||||
if (lx === -1) {
|
if (lx === -1) {
|
||||||
lx = x;
|
lx = x;
|
||||||
ly = y;
|
ly = y;
|
||||||
|
@ -1208,9 +1203,7 @@ Screen.prototype.draw = function(start, end) {
|
||||||
if (this.fullUnicode) {
|
if (this.fullUnicode) {
|
||||||
// If this is a surrogate pair double-width char, we can ignore it
|
// If this is a surrogate pair double-width char, we can ignore it
|
||||||
// because parseContent already counted it as length=2.
|
// because parseContent already counted it as length=2.
|
||||||
point = unicode.codePointAt(line[x][1], 0);
|
if (unicode.charWidth(line[x][1]) === 2) {
|
||||||
cwid = unicode.charWidth(point);
|
|
||||||
if (cwid === 2) {
|
|
||||||
// Might also need: `line[x + 1][0] !== line[x][0]`
|
// Might also need: `line[x + 1][0] !== line[x][0]`
|
||||||
// for borderless boxes?
|
// for borderless boxes?
|
||||||
if (x === line.length - 1 || angles[line[x + 1][1]]) {
|
if (x === line.length - 1 || angles[line[x + 1][1]]) {
|
||||||
|
@ -2033,9 +2026,7 @@ Screen.prototype.screenshot = function(xi, xl, yi, yl, term) {
|
||||||
, out
|
, out
|
||||||
, ch
|
, ch
|
||||||
, data
|
, data
|
||||||
, attr
|
, attr;
|
||||||
, cwid
|
|
||||||
, point;
|
|
||||||
|
|
||||||
var sdattr = this.dattr;
|
var sdattr = this.dattr;
|
||||||
|
|
||||||
|
@ -2076,9 +2067,7 @@ Screen.prototype.screenshot = function(xi, xl, yi, yl, term) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fullUnicode) {
|
if (this.fullUnicode) {
|
||||||
point = unicode.codePointAt(line[x][1], 0);
|
if (unicode.charWidth(line[x][1]) === 2) {
|
||||||
cwid = unicode.charWidth(point);
|
|
||||||
if (cwid === 2) {
|
|
||||||
if (x === xl - 1) {
|
if (x === xl - 1) {
|
||||||
ch = ' ';
|
ch = ' ';
|
||||||
} else {
|
} else {
|
||||||
|
@ -2469,7 +2458,6 @@ Element.prototype.parseContent = function(noTags) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.textLength = function(text) {
|
Element.prototype.textLength = function(text) {
|
||||||
// return unicode.strWidth(text);
|
|
||||||
if (!this.parseTags) return text.length;
|
if (!this.parseTags) return text.length;
|
||||||
return text
|
return text
|
||||||
.replace(/{(\/?)([\w\-,;!#]*)}/g, '')
|
.replace(/{(\/?)([\w\-,;!#]*)}/g, '')
|
||||||
|
@ -4150,19 +4138,6 @@ Element.prototype.render = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alternative to regex to avoiding combining chars when fullUnicode=false
|
|
||||||
// NOTE: Wouldn't matter because the surrogate regex would already remove it.
|
|
||||||
// if (!this.screen.fullUnicode) {
|
|
||||||
// var point = unicode.codePointAt(content, ci - 1);
|
|
||||||
// if (unicode.combining[point]) {
|
|
||||||
// if (point > 0x00ffff) {
|
|
||||||
// ci++;
|
|
||||||
// }
|
|
||||||
// x--;
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.style.transparent) {
|
if (this.style.transparent) {
|
||||||
lines[y][x][0] = blend(attr, lines[y][x][0]);
|
lines[y][x][0] = blend(attr, lines[y][x][0]);
|
||||||
if (content[ci]) lines[y][x][1] = ch;
|
if (content[ci]) lines[y][x][1] = ch;
|
||||||
|
|
|
@ -95,12 +95,7 @@ var lorem = 'Non eram nes' + (!~process.argv.indexOf('s') ? COMBINE : '')
|
||||||
lorem = lorem.replace(/e/gi, DOUBLE);
|
lorem = lorem.replace(/e/gi, DOUBLE);
|
||||||
//lorem = lorem.replace(/e/gi, DU);
|
//lorem = lorem.replace(/e/gi, DU);
|
||||||
//lorem = lorem.replace(/r/gi, JUAN);
|
//lorem = lorem.replace(/r/gi, JUAN);
|
||||||
// NOTE: libvte breaks when trying to display
|
|
||||||
// this surrogate pair double width character:
|
|
||||||
// if (!~process.argv.indexOf('vte') && !screen.program.isVTE) {
|
|
||||||
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);
|
||||||
if (~process.argv.indexOf('s')) {
|
if (~process.argv.indexOf('s')) {
|
||||||
lorem = lorem.replace(/s/gi, 's' + COMBINE);
|
lorem = lorem.replace(/s/gi, 's' + COMBINE);
|
||||||
|
|
Loading…
Reference in New Issue