mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-26 02:40:23 +00:00
tput.js fixes.
This commit is contained in:
parent
efbae0c203
commit
d63762fbe8
39
lib/tput.js
39
lib/tput.js
@ -1092,28 +1092,37 @@ Tput.prototype.readTermcap = function(term) {
|
||||
, term = term || this.terminal
|
||||
, TERMCAP = process.env.TERMCAP || ''
|
||||
, TERMPATH = process.env.TERMPATH || ''
|
||||
, HOME = process.env.HOME || '';
|
||||
, HOME = process.env.HOME || ''
|
||||
, terms
|
||||
, term_
|
||||
, root;
|
||||
|
||||
// Termcap has a bunch of terminals usually stored in one file/string,
|
||||
// so we need to find the one containing our desired terminal.
|
||||
var terms = (term[0] === '/' && this._tryCap(term))
|
||||
|| this._tryCap(this.termcapFile, term)
|
||||
|| this._tryCap(TERMCAP, term)
|
||||
|| this._tryCap(TERMPATH && TERMPATH.split(/[: ]/), term)
|
||||
|| this._tryCap(HOME + '/.termcap', term)
|
||||
|| this._tryCap('/usr/share/misc/termcap', term)
|
||||
|| this._tryCap('/etc/termcap', term)
|
||||
|| this._tryCap(Tput.termcap, term);
|
||||
if (term[0] === '/' && (terms = this._tryCap(term))) {
|
||||
term_ = path.basename(term).split('.')[0];
|
||||
if (terms[process.env.TERM]) {
|
||||
term = process.env.TERM;
|
||||
} else if (terms[term_]) {
|
||||
term = term_;
|
||||
} else {
|
||||
term = Object.keys(terms)[0];
|
||||
}
|
||||
} else {
|
||||
terms = this._tryCap(this.termcapFile, term)
|
||||
|| this._tryCap(TERMCAP, term)
|
||||
|| this._tryCap(TERMPATH && TERMPATH.split(/[: ]/), term)
|
||||
|| this._tryCap(HOME + '/.termcap', term)
|
||||
|| this._tryCap('/usr/share/misc/termcap', term)
|
||||
|| this._tryCap('/etc/termcap', term)
|
||||
|| this._tryCap(Tput.termcap, term);
|
||||
}
|
||||
|
||||
if (!terms) {
|
||||
throw new Error('Cannot find termcap for: ' + term);
|
||||
}
|
||||
|
||||
if (term[0] === '/') {
|
||||
term = Object.keys(terms)[0];
|
||||
}
|
||||
|
||||
var root = terms[term];
|
||||
root = terms[term];
|
||||
|
||||
if (this.debug) {
|
||||
this._termcap = terms;
|
||||
@ -1589,7 +1598,7 @@ Tput.prototype._captoinfo = function(cap, s, parameterized) {
|
||||
if ((s[i] === '=' || s[i] === '+' || s[i] === '-'
|
||||
|| s[i] === '*' || s[i] === '/')
|
||||
&& (s[i + 1] === 'p' || s[i + 1] === 'c')
|
||||
&& s[i + 2] !== '\0') {
|
||||
&& s[i + 2] !== '\0' && s[i + 2]) {
|
||||
var l;
|
||||
l = 2;
|
||||
if (s[i] !== '=') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user