fix clr_eos/ed and other possible collisions.

This commit is contained in:
Christopher Jeffrey 2013-02-25 02:05:27 -06:00
parent 68911aa357
commit ea4542027b
2 changed files with 28 additions and 1 deletions

View File

@ -1053,7 +1053,9 @@ Program.prototype.eraseInDisplay = function(param) {
};
Program.prototype.clear = function() {
return this.eraseInDisplay('all');
if (this.tput) return this.tput.clear();
return this.write('\x1b[H\x1b[J');
// return this.ed('all');
};
// CSI Ps K Erase in Line (EL).

View File

@ -1188,6 +1188,31 @@ delete Tput.alias.numbers;
merge(Tput.alias, Tput.alias.strings);
delete Tput.alias.strings;
// Make sure there are no collisions between cap and tcap.
Tput._vec = [];
Object.keys(Tput.alias).forEach(function(key) {
if (!Array.isArray(Tput.alias[key])) {
return Tput._vec.push(Tput.alias[key]);
}
Tput._vec.push(Tput.alias[key][0]);
});
Object.keys(Tput.alias).forEach(function(key) {
if (!Array.isArray(Tput.alias[key])) {
return;
}
var alias = Tput.alias[key]
, tcap = alias[1];
if (!tcap) return;
if (~Tput._vec.indexOf(tcap)) {
alias.splice(1, 1);
}
});
/**
* Terminfo Data
*/