mirror of
https://github.com/nuintun/command-manager.git
synced 2025-12-15 23:30:48 +08:00
update files
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user