diff --git a/lib/program.js b/lib/program.js index 253913d..5877265 100644 --- a/lib/program.js +++ b/lib/program.js @@ -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'); };