diff --git a/lib/program.js b/lib/program.js index aa61aa9..f5ce7f4 100644 --- a/lib/program.js +++ b/lib/program.js @@ -52,7 +52,10 @@ function Program(options) { this.scrollTop = 0; this.scrollBottom = this.rows - 1; - this.terminal = options.terminal || process.env.TERM || 'xterm'; + this.terminal = options.term + || options.terminal + || process.env.TERM + || 'xterm'; // if (!Program.global) { // Program._write = process.stdout.write; diff --git a/lib/tput.js b/lib/tput.js index 2c3f16c..0419c07 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -39,7 +39,10 @@ function Tput(options) { } this.options = options; - this.term = options.term || process.env.TERM; + this.terminal = options.term + || options.terminal + || process.env.TERM + || 'xterm'; this.debug = options.debug; this.padding = options.padding; @@ -74,20 +77,20 @@ function Tput(options) { */ Tput.prototype._useVt102C = function() { - this.term = 'vt102'; + this.terminal = 'vt102'; this.termcap = true; this.compileTermcap(); }; Tput.prototype._useXtermC = function() { - this.term = 'xterm'; + this.terminal = 'xterm'; this.termcap = true; this.termcapFile = __dirname + '/../usr/xterm.termcap'; this.compileTermcap(); }; Tput.prototype._useXtermI = function() { - this.term = 'xterm'; + this.terminal = 'xterm'; this.termcap = false; this.terminfoFile = __dirname + '/../usr/xterm'; this.compileTerminfo(); @@ -120,8 +123,8 @@ Tput.prototype._terminfoPrefix = function(prefix) { var file = path.resolve( prefix, - path.basename(this.term[0]), - path.basename(this.term) + path.basename(this.terminal[0]), + path.basename(this.terminal) ); try { @@ -1089,7 +1092,7 @@ Tput.prototype.readTermcap = function(data) { || Tput.termcap; var terms = this.parseTermcap(data) - , root = terms[this.term]; + , root = terms[this.terminal]; if (this.debug) { this._termcap = terms; @@ -1318,12 +1321,12 @@ Tput.prototype.detectBrokenACS = function() { } // The linux console is just broken for some reason. - if (this.term === 'linux') { + if (this.terminal === 'linux') { return true; } // screen termcap is bugged? - if (this.term.indexOf('screen') == 0 + if (this.terminal.indexOf('screen') == 0 && process.env.TERMCAP && ~process.env.TERMCAP.indexOf('screen') && ~process.env.TERMCAP.indexOf('hhII00')) {