handle terminfo fallback better.

This commit is contained in:
Christopher Jeffrey 2013-03-05 17:38:41 -06:00
parent 87ffe00a06
commit 962a7bdcc6

View File

@ -51,16 +51,36 @@ function Tput(options) {
this.compileTerminfo(); this.compileTerminfo();
} }
} catch (e) { } catch (e) {
// if (e.message === 'Terminal not found.') { // If there was an error, fallback
this.term = 'vt102'; // to an internally stored terminfo/cap.
this.compileTermcap(); this._useXtermI();
// this.term = 'xterm';
// this.termcap = true;
// this.termcapFile = __dirname + '/../usr/xterm.termcap';
// this.compileTermcap();
} }
} }
/**
* Fallback
*/
Tput.prototype._useVt102C = function() {
this.term = 'vt102';
this.termcap = true;
this.compileTermcap();
};
Tput.prototype._useXtermC = function() {
this.term = 'xterm';
this.termcap = true;
this.termcapFile = __dirname + '/../usr/xterm.termcap';
this.compileTermcap();
};
Tput.prototype._useXtermI = function() {
this.term = 'xterm';
this.termcap = false;
this.terminfoFile = __dirname + '/../usr/xterm.terminfo';
this.compileTerminfo();
};
/** /**
* Terminfo * Terminfo
*/ */