fix CHA, fix SU and SD.

This commit is contained in:
Christopher Jeffrey 2013-07-18 00:22:24 -05:00
parent 5c114b8b69
commit 7b7330ec5a

View File

@ -1895,7 +1895,7 @@ Program.prototype.cursorCharAbsolute = function(param) {
this.x = param; this.x = param;
this.y = 0; this.y = 0;
this._ncoords(); this._ncoords();
if (this.tput) return this.put.cha(param); if (this.tput) return this.put.hpa(param);
return this.write('\x1b[' + (param + 1) + 'G'); return this.write('\x1b[' + (param + 1) + 'G');
}; };
@ -1933,7 +1933,6 @@ Program.prototype.eraseChars = function(param) {
// CSI Pm ` Character Position Absolute // CSI Pm ` Character Position Absolute
// [column] (default = [row,1]) (HPA). // [column] (default = [row,1]) (HPA).
// NOTE: Can't find in terminfo, no idea why it has multiple params.
Program.prototype.hpa = Program.prototype.hpa =
Program.prototype.charPosAbsolute = function(param) { Program.prototype.charPosAbsolute = function(param) {
this.x = param || 0; this.x = param || 0;
@ -2137,11 +2136,7 @@ Program.prototype.HVPosition = function(row, col) {
// http://vt100.net/docs/vt220-rm/chapter4.html // http://vt100.net/docs/vt220-rm/chapter4.html
Program.prototype.sm = Program.prototype.sm =
Program.prototype.setMode = function() { Program.prototype.setMode = function() {
// tput: TODO
var param = Array.prototype.slice.call(arguments).join(';'); var param = Array.prototype.slice.call(arguments).join(';');
//if (private) {
// return this.write('\x1b[?' + (param || '') + 'h');
//}
return this.write('\x1b[' + (param || '') + 'h'); return this.write('\x1b[' + (param || '') + 'h');
}; };
@ -2171,8 +2166,6 @@ Program.prototype.alternateBuffer = function() {
this.isAlt = true; this.isAlt = true;
if (this.tput) return this.put.smcup(); if (this.tput) return this.put.smcup();
if (this.term('vt') || this.term('linux')) return; if (this.term('vt') || this.term('linux')) return;
//return this.setMode('?47');
//return this.setMode('?1047');
return this.setMode('?1049'); return this.setMode('?1049');
}; };
@ -2258,11 +2251,7 @@ Program.prototype.alternateBuffer = function() {
// Ps = 2 0 0 4 -> Reset bracketed paste mode. // Ps = 2 0 0 4 -> Reset bracketed paste mode.
Program.prototype.rm = Program.prototype.rm =
Program.prototype.resetMode = function() { Program.prototype.resetMode = function() {
// tput: TODO
var param = Array.prototype.slice.call(arguments).join(';'); var param = Array.prototype.slice.call(arguments).join(';');
//if (private) {
// return this.write('\x1b[?' + (param || '') + 'l');
//}
return this.write('\x1b[' + (param || '') + 'l'); return this.write('\x1b[' + (param || '') + 'l');
}; };
@ -2284,8 +2273,6 @@ Program.prototype.hideCursor = function() {
Program.prototype.rmcup = Program.prototype.rmcup =
Program.prototype.normalBuffer = function() { Program.prototype.normalBuffer = function() {
this.isAlt = false; this.isAlt = false;
//return this.resetMode('?47');
//return this.resetMode('?1047');
if (this.tput) return this.put.rmcup(); if (this.tput) return this.put.rmcup();
return this.resetMode('?1049'); return this.resetMode('?1049');
}; };
@ -2466,9 +2453,7 @@ Program.prototype.cht =
Program.prototype.cursorForwardTab = function(param) { Program.prototype.cursorForwardTab = function(param) {
this.x += 8; this.x += 8;
this._ncoords(); this._ncoords();
// Does not exist (?): if (this.tput) return this.put.tab(param);
// if (this.tput) return this.put.cht(param);
if (this.tput) return this.put.tab(param); // or this.put.ht
return this.write('\x1b[' + (param || 1) + 'I'); return this.write('\x1b[' + (param || 1) + 'I');
}; };
@ -2477,10 +2462,8 @@ Program.prototype.su =
Program.prototype.scrollUp = function(param) { Program.prototype.scrollUp = function(param) {
this.y -= param || 1; this.y -= param || 1;
this._ncoords(); this._ncoords();
// Does not exist: if (this.tput) return this.put.parm_index(param);
// if (this.tput) return this.put.su(param); return this.write('\x1b[' + (param || 1) + 'S');
if (this.tput) return this.put.rin(param);
return this.write('\x1b[' + (param || 1) + 'I');
}; };
// CSI Ps T Scroll down Ps lines (default = 1) (SD). // CSI Ps T Scroll down Ps lines (default = 1) (SD).
@ -2488,9 +2471,7 @@ Program.prototype.sd =
Program.prototype.scrollDown = function(param) { Program.prototype.scrollDown = function(param) {
this.y += param || 1; this.y += param || 1;
this._ncoords(); this._ncoords();
// Does not exist: if (this.tput) return this.put.parm_rindex(param);
// if (this.tput) return this.put.sd(param);
if (this.tput) return this.put.indn(param);
return this.write('\x1b[' + (param || 1) + 'T'); return this.write('\x1b[' + (param || 1) + 'T');
}; };
@ -2529,8 +2510,8 @@ Program.prototype.cursorBackwardTab = function(param) {
// CSI Ps b Repeat the preceding graphic character Ps times (REP). // CSI Ps b Repeat the preceding graphic character Ps times (REP).
Program.prototype.rep = Program.prototype.rep =
Program.prototype.repeatPrecedingCharacter = function(param) { Program.prototype.repeatPrecedingCharacter = function(param) {
//this.x += param || 1; this.x += param || 1;
//this._ncoords(); this._ncoords();
if (this.tput) return this.put.rep(param); if (this.tput) return this.put.rep(param);
return this.write('\x1b[' + (param || 1) + 'b'); return this.write('\x1b[' + (param || 1) + 'b');
}; };
@ -2560,10 +2541,6 @@ Program.prototype.tabClear = function(param) {
// Ps = 1 1 -> Print all pages. // Ps = 1 1 -> Print all pages.
Program.prototype.mc = Program.prototype.mc =
Program.prototype.mediaCopy = function() { Program.prototype.mediaCopy = function() {
//if (dec) {
// this.write('\x1b[?' + Array.prototype.slice.call(arguments).join(';') + 'i');
// return;
//}
return this.write('\x1b[' + Array.prototype.slice.call(arguments).join(';') + 'i'); return this.write('\x1b[' + Array.prototype.slice.call(arguments).join(';') + 'i');
}; };