update files

This commit is contained in:
nuintun
2015-11-24 22:00:46 +08:00
parent 085a5cf350
commit 32ae3adceb
24 changed files with 149 additions and 142 deletions

View File

@@ -9,8 +9,11 @@ module.exports = function (Terminal){
// [column] (default = [row,1]) (HPA).
Terminal.prototype.charPosAbsolute = function (params){
var param = params[0];
if (param < 1) param = 1;
this.x = param - 1;
if (this.x >= this.cols) {
this.x = this.cols - 1;
}
@@ -21,8 +24,11 @@ module.exports = function (Terminal){
// reuse CSI Ps C ?
Terminal.prototype.HPositionRelative = function (params){
var param = params[0];
if (param < 1) param = 1;
this.x += param;
if (this.x >= this.cols) {
this.x = this.cols - 1;
}
@@ -32,8 +38,11 @@ module.exports = function (Terminal){
// Line Position Absolute [row] (default = [1,column]) (VPA).
Terminal.prototype.linePosAbsolute = function (params){
var param = params[0];
if (param < 1) param = 1;
this.y = param - 1;
if (this.y >= this.rows) {
this.y = this.rows - 1;
}
@@ -43,8 +52,11 @@ module.exports = function (Terminal){
// reuse CSI Ps B ?
Terminal.prototype.VPositionRelative = function (params){
var param = params[0];
if (param < 1) param = 1;
this.y += param;
if (this.y >= this.rows) {
this.y = this.rows - 1;
}
@@ -55,14 +67,17 @@ module.exports = function (Terminal){
// [1,1]) (HVP).
Terminal.prototype.HVPosition = function (params){
if (params[0] < 1) params[0] = 1;
if (params[1] < 1) params[1] = 1;
this.y = params[0] - 1;
if (this.y >= this.rows) {
this.y = this.rows - 1;
}
this.x = params[1] - 1;
if (this.x >= this.cols) {
this.x = this.cols - 1;
}