refactor. comment.
This commit is contained in:
parent
ea4542027b
commit
b71203be18
18
lib/tput.js
18
lib/tput.js
|
@ -297,6 +297,7 @@ Tput.prototype.parseExtended = function(data) {
|
||||||
|
|
||||||
// Pass over the sym offsets and get to the string table.
|
// Pass over the sym offsets and get to the string table.
|
||||||
i = data.length - h.lastStrTableOffset;
|
i = data.length - h.lastStrTableOffset;
|
||||||
|
// Might be better to do this instead if the file has trailing bytes:
|
||||||
// i += h.symOffsetCount * 2;
|
// i += h.symOffsetCount * 2;
|
||||||
|
|
||||||
// String Table
|
// String Table
|
||||||
|
@ -411,6 +412,10 @@ Tput.prototype.compile = function(key) {
|
||||||
if (alias) {
|
if (alias) {
|
||||||
if (!Array.isArray(alias)) alias = [alias];
|
if (!Array.isArray(alias)) alias = [alias];
|
||||||
alias.forEach(function(alias) {
|
alias.forEach(function(alias) {
|
||||||
|
if (self.methods[alias] && alias !== key && alias !== 'ML') {
|
||||||
|
// We can ignore `lines` and `ML` here.
|
||||||
|
throw new Error('Alias collision: ' + key + ' -> ' + alias);
|
||||||
|
}
|
||||||
self.methods[alias] = self.methods[key];
|
self.methods[alias] = self.methods[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1189,13 +1194,10 @@ merge(Tput.alias, Tput.alias.strings);
|
||||||
delete Tput.alias.strings;
|
delete Tput.alias.strings;
|
||||||
|
|
||||||
// Make sure there are no collisions between cap and tcap.
|
// Make sure there are no collisions between cap and tcap.
|
||||||
Tput._vec = [];
|
Tput._vec = Object.keys(Tput.alias).map(function(key) {
|
||||||
|
return Array.isArray(Tput.alias[key])
|
||||||
Object.keys(Tput.alias).forEach(function(key) {
|
? Tput.alias[key][0]
|
||||||
if (!Array.isArray(Tput.alias[key])) {
|
: Tput.alias[key];
|
||||||
return Tput._vec.push(Tput.alias[key]);
|
|
||||||
}
|
|
||||||
Tput._vec.push(Tput.alias[key][0]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(Tput.alias).forEach(function(key) {
|
Object.keys(Tput.alias).forEach(function(key) {
|
||||||
|
@ -1213,6 +1215,8 @@ Object.keys(Tput.alias).forEach(function(key) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assert.equal(Tput.alias.exit_delete_mode[1], undefined);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminfo Data
|
* Terminfo Data
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue