diff --git a/lib/tput.js b/lib/tput.js index 40b8367..e5b591b 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -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;