cleanup _prefix and readTermcap.
This commit is contained in:
parent
a1c91ccb99
commit
97b6d6faee
22
lib/tput.js
22
lib/tput.js
|
@ -168,24 +168,19 @@ Tput.prototype._prefix = function(term) {
|
|||
}
|
||||
|
||||
var paths = Tput.ipaths.slice()
|
||||
, file
|
||||
, i;
|
||||
, file;
|
||||
|
||||
if (this.terminfoPrefix) {
|
||||
paths.unshift(this.terminfoPrefix);
|
||||
}
|
||||
|
||||
// Try exact matches.
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
file = this._tprefix(paths[i], term);
|
||||
if (file) return file;
|
||||
}
|
||||
file = this._tprefix(paths, term);
|
||||
if (file) return file;
|
||||
|
||||
// Try similar matches.
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
file = this._tprefix(paths[i], term, true);
|
||||
if (file) return file;
|
||||
}
|
||||
file = this._tprefix(paths, term, true);
|
||||
if (file) return file;
|
||||
|
||||
// Not found.
|
||||
throw new Error('Terminfo directory not found.');
|
||||
|
@ -205,7 +200,7 @@ Tput.prototype._tprefix = function(prefix, term, soft) {
|
|||
|
||||
if (Array.isArray(prefix)) {
|
||||
for (i = 0; i < prefix.length; i++) {
|
||||
file = this._tprefix(prefix[i], term);
|
||||
file = this._tprefix(prefix[i], term, soft);
|
||||
if (file) return file;
|
||||
}
|
||||
return;
|
||||
|
@ -1259,10 +1254,7 @@ Tput.prototype.readTermcap = function(term) {
|
|||
|
||||
paths.push(Tput.termcap);
|
||||
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
terms = this._tryCap(paths[i], term);
|
||||
if (terms) break;
|
||||
}
|
||||
terms = this._tryCap(paths, term);
|
||||
}
|
||||
|
||||
if (!terms) {
|
||||
|
|
Loading…
Reference in New Issue