add workaround for screen-256color terminfo. use correct terminfo fallback.

This commit is contained in:
Christopher Jeffrey 2013-06-07 06:42:47 -05:00
parent 8f0025c650
commit 8cca60beac
1 changed files with 10 additions and 1 deletions

View File

@ -84,7 +84,7 @@ Tput.prototype._useXtermC = function() {
Tput.prototype._useXtermI = function() {
this.term = 'xterm';
this.termcap = false;
this.terminfoFile = __dirname + '/../usr/xterm.terminfo';
this.terminfoFile = __dirname + '/../usr/xterm';
this.compileTerminfo();
};
@ -225,6 +225,15 @@ Tput.prototype.parseTerminfo = function(data) {
return;
}
// Workaround: fix an odd bug in the screen-256color terminfo where it tries
// to set -1, but it appears to have {0xfe, 0xff} instead of {0xff, 0xff}.
// TODO: Possibly handle errors gracefully below, as well as in the
// extended info. Also possibly do: `if (info.strings[key] >= data.length)`.
if (info.strings[key] === 65534) {
delete info.strings[key];
return;
}
var s = i + info.strings[key]
, j = s;