check for parm_*_cursor terminfo on program.cu[udbf].

This commit is contained in:
Christopher Jeffrey 2015-08-11 03:01:01 -07:00
parent a1ddc1443c
commit 607dc29dbb
1 changed files with 26 additions and 6 deletions

View File

@ -2283,7 +2283,12 @@ Program.prototype.up =
Program.prototype.cursorUp = function(param) {
this.y -= param || 1;
this._ncoords();
if (this.tput) return this.put.cuu(param);
if (this.tput) {
if (!this.tput.strings.parm_up_cursor) {
return this._write(this.repeat(this.tput.cuu1(), param));
}
return this.put.cuu(param);
}
return this._write('\x1b[' + (param || '') + 'A');
};
@ -2294,7 +2299,12 @@ Program.prototype.down =
Program.prototype.cursorDown = function(param) {
this.y += param || 1;
this._ncoords();
if (this.tput) return this.put.cud(param);
if (this.tput) {
if (!this.tput.strings.parm_down_cursor) {
return this._write(this.repeat(this.tput.cud1(), param));
}
return this.put.cud(param);
}
return this._write('\x1b[' + (param || '') + 'B');
};
@ -2306,7 +2316,12 @@ Program.prototype.forward =
Program.prototype.cursorForward = function(param) {
this.x += param || 1;
this._ncoords();
if (this.tput) return this.put.cuf(param);
if (this.tput) {
if (!this.tput.strings.parm_right_cursor) {
return this._write(this.repeat(this.tput.cuf1(), param));
}
return this.put.cuf(param);
}
return this._write('\x1b[' + (param || '') + 'C');
};
@ -2318,7 +2333,12 @@ Program.prototype.back =
Program.prototype.cursorBackward = function(param) {
this.x -= param || 1;
this._ncoords();
if (this.tput) return this.put.cub(param);
if (this.tput) {
if (!this.tput.strings.parm_left_cursor) {
return this._write(this.repeat(this.tput.cub1(), param));
}
return this.put.cub(param);
}
return this._write('\x1b[' + (param || '') + 'D');
};
@ -2967,11 +2987,11 @@ Program.prototype.charPosAbsolute = function(param) {
// reuse CSI Ps C ?
Program.prototype.hpr =
Program.prototype.HPositionRelative = function(param) {
if (this.tput) return this.cuf(param);
this.x += param || 1;
this._ncoords();
// Does not exist:
// if (this.tput) return this.put.hpr(param);
if (this.tput) return this.put.cuf(param);
return this._write('\x1b[' + (param || '') + 'a');
};
@ -3034,11 +3054,11 @@ Program.prototype.linePosAbsolute = function(param) {
// reuse CSI Ps B ?
Program.prototype.vpr =
Program.prototype.VPositionRelative = function(param) {
if (this.tput) return this.cud(param);
this.y += param || 1;
this._ncoords();
// Does not exist:
// if (this.tput) return this.put.vpr(param);
if (this.tput) return this.put.cud(param);
return this._write('\x1b[' + (param || '') + 'e');
};