fix disappearing double-width chars on scroll up.

This commit is contained in:
Christopher Jeffrey 2015-04-16 12:26:31 -07:00
parent d520c94c3b
commit 0acae98979
2 changed files with 18 additions and 3 deletions

View File

@ -1111,6 +1111,9 @@ Screen.prototype.draw = function(start, end) {
// Optimize by comparing the real output
// buffer to the pending output buffer.
if (data === o[x][0] && ch === o[x][1]) {
// if (unicode.charWidth(ch, 0) === 2) {
// x++;
// }
if (lx === -1) {
lx = x;
ly = y;
@ -1209,9 +1212,17 @@ Screen.prototype.draw = function(start, end) {
// Might also need: `line[x + 1][0] !== line[x][0]`
// for borderless boxes?
if (x === line.length - 1 || angles[line[x + 1][1]]) {
// If we're at the end, we don't have enough space for a
// double-width. Overwrite it with a space and ignore.
ch = ' ';
o[x][1] = ' ';
} else {
// ALWAYS refresh double-width chars because this special cursor
// behavior is needed. There may be a more efficient way of doing
// this. See above.
o[x][1] = ' ';
// Eat the next character by moving forward and marking as a
// space (which it is).
o[++x][1] = ' ';
}
}

View File

@ -5,7 +5,7 @@ screen = blessed.screen({
dump: __dirname + '/logs/eaw.log',
smartCSR: true,
dockBorders: true,
fullUnicode: process.argv[2] === '-' ? false : true
fullUnicode: ~process.argv.indexOf('-') ? false : true
});
// screen.options.fullUnicode = false;
@ -40,7 +40,8 @@ var COMBINE = blessed.unicode.fromCodePoint(0x10A01);
// At cols=44, the bug that is avoided by this occurs:
// || angles[line[x + 1][1]]) {
var lorem = 'Non eram nes' + COMBINE + 'cius Brute cum quae summis ingeniis exquisitaque'
var lorem = 'Non eram nes' + (!~process.argv.indexOf('s') ? COMBINE : '')
+ 'cius Brute cum quae summis ingeniis exquisitaque'
+ ' doctrina philosophi Graeco sermone tractavissent ea Latinis litteris mandaremus'
+ ' fore ut hic noster labor in varias reprehensiones incurreret nam quibusdam et'
+ ' iis quidem non admodum indoctis totum hoc displicet philosophari quidam autem'
@ -88,10 +89,13 @@ var lorem = 'Non eram nes' + COMBINE + 'cius Brute cum quae summis ingeniis exqu
lorem = lorem.replace(/e/gi, DOUBLE);
// NOTE: libvte breaks when trying to display
// this surrogate pair double width character:
if (process.argv[2] !== 'vte') {
if (~process.argv.indexOf('vte')) {
lorem = lorem.replace(/a/gi, SURROGATE_DOUBLE);
}
lorem = lorem.replace(/o/gi, SURROGATE_SINGLE);
if (~process.argv.indexOf('s')) {
lorem = lorem.replace(/s/gi, 's' + COMBINE);
}
var main = blessed.box({
parent: screen,