mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 09:51:31 +08:00
update files
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function (Terminal){
|
||||
|
||||
// CSI Pm m Character Attributes (SGR).
|
||||
// Ps = 0 -> Normal (default).
|
||||
// Ps = 1 -> Bold.
|
||||
|
@@ -7,14 +7,14 @@
|
||||
module.exports = function (Terminal){
|
||||
// CSI s
|
||||
// Save cursor (ANSI.SYS).
|
||||
Terminal.prototype.saveCursor = function (params){
|
||||
Terminal.prototype.saveCursor = function (){
|
||||
this.savedX = this.x;
|
||||
this.savedY = this.y;
|
||||
};
|
||||
|
||||
// CSI u
|
||||
// Restore cursor (ANSI.SYS).
|
||||
Terminal.prototype.restoreCursor = function (params){
|
||||
Terminal.prototype.restoreCursor = function (){
|
||||
this.x = this.savedX || 0;
|
||||
this.y = this.savedY || 0;
|
||||
};
|
||||
@@ -23,8 +23,11 @@ module.exports = function (Terminal){
|
||||
// Cursor Up Ps Times (default = 1) (CUU).
|
||||
Terminal.prototype.cursorUp = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.y -= param;
|
||||
|
||||
if (this.y < 0) this.y = 0;
|
||||
};
|
||||
|
||||
@@ -32,8 +35,11 @@ module.exports = function (Terminal){
|
||||
// Cursor Down Ps Times (default = 1) (CUD).
|
||||
Terminal.prototype.cursorDown = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.y += param;
|
||||
|
||||
if (this.y >= this.rows) {
|
||||
this.y = this.rows - 1;
|
||||
}
|
||||
@@ -43,8 +49,11 @@ module.exports = function (Terminal){
|
||||
// Cursor Forward Ps Times (default = 1) (CUF).
|
||||
Terminal.prototype.cursorForward = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.x += param;
|
||||
|
||||
if (this.x >= this.cols) {
|
||||
this.x = this.cols - 1;
|
||||
}
|
||||
@@ -54,8 +63,11 @@ module.exports = function (Terminal){
|
||||
// Cursor Backward Ps Times (default = 1) (CUB).
|
||||
Terminal.prototype.cursorBackward = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.x -= param;
|
||||
|
||||
if (this.x < 0) this.x = 0;
|
||||
};
|
||||
|
||||
@@ -93,11 +105,15 @@ module.exports = function (Terminal){
|
||||
// same as CSI Ps B ?
|
||||
Terminal.prototype.cursorNextLine = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.y += param;
|
||||
|
||||
if (this.y >= this.rows) {
|
||||
this.y = this.rows - 1;
|
||||
}
|
||||
|
||||
this.x = 0;
|
||||
};
|
||||
|
||||
@@ -106,9 +122,13 @@ module.exports = function (Terminal){
|
||||
// reuse CSI Ps A ?
|
||||
Terminal.prototype.cursorPrecedingLine = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.y -= param;
|
||||
|
||||
if (this.y < 0) this.y = 0;
|
||||
|
||||
this.x = 0;
|
||||
};
|
||||
|
||||
@@ -116,7 +136,9 @@ module.exports = function (Terminal){
|
||||
// Cursor Character Absolute [column] (default = [row,1]) (CHA).
|
||||
Terminal.prototype.cursorCharAbsolute = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
this.x = param - 1;
|
||||
};
|
||||
|
||||
@@ -124,6 +146,7 @@ module.exports = function (Terminal){
|
||||
// Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
|
||||
Terminal.prototype.cursorForwardTab = function (params){
|
||||
var param = params[0] || 1;
|
||||
|
||||
while (param--) {
|
||||
this.x = this.nextStop();
|
||||
}
|
||||
@@ -132,9 +155,9 @@ module.exports = function (Terminal){
|
||||
// CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
|
||||
Terminal.prototype.cursorBackwardTab = function (params){
|
||||
var param = params[0] || 1;
|
||||
|
||||
while (param--) {
|
||||
this.x = this.prevStop();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
@@ -12,6 +12,7 @@ module.exports = function (Terminal){
|
||||
var param, row, j, ch;
|
||||
|
||||
param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
row = this.y + this.ybase;
|
||||
@@ -30,9 +31,10 @@ module.exports = function (Terminal){
|
||||
var param, row, j;
|
||||
|
||||
param = params[0];
|
||||
if (param < 1) param = 1;
|
||||
row = this.y + this.ybase;
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
row = this.y + this.ybase;
|
||||
j = this.rows - 1 - this.scrollBottom;
|
||||
j = this.rows - 1 + this.ybase - j + 1;
|
||||
|
||||
@@ -54,9 +56,10 @@ module.exports = function (Terminal){
|
||||
var param, row, j;
|
||||
|
||||
param = params[0];
|
||||
if (param < 1) param = 1;
|
||||
row = this.y + this.ybase;
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
row = this.y + this.ybase;
|
||||
j = this.rows - 1 - this.scrollBottom;
|
||||
j = this.rows - 1 + this.ybase - j;
|
||||
|
||||
@@ -78,6 +81,7 @@ module.exports = function (Terminal){
|
||||
var param, row, ch;
|
||||
|
||||
param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
row = this.y + this.ybase;
|
||||
@@ -95,6 +99,7 @@ module.exports = function (Terminal){
|
||||
var param, row, j, ch;
|
||||
|
||||
param = params[0];
|
||||
|
||||
if (param < 1) param = 1;
|
||||
|
||||
row = this.y + this.ybase;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -7,9 +7,9 @@
|
||||
module.exports = function (Terminal){
|
||||
// CSI Ps b Repeat the preceding graphic character Ps times (REP).
|
||||
Terminal.prototype.repeatPrecedingCharacter = function (params){
|
||||
var param = params[0] || 1,
|
||||
line = this.lines[this.ybase + this.y],
|
||||
ch = line[this.x - 1] || [this.defAttr, ' '];
|
||||
var param = params[0] || 1;
|
||||
var line = this.lines[this.ybase + this.y];
|
||||
var ch = line[this.x - 1] || [this.defAttr, ' '];
|
||||
|
||||
while (param--) line[this.x++] = ch;
|
||||
};
|
||||
|
@@ -7,7 +7,7 @@
|
||||
module.exports = function (Terminal){
|
||||
// CSI ! p Soft terminal reset (DECSTR).
|
||||
// http://vt100.net/docs/vt220-rm/table4-10.html
|
||||
Terminal.prototype.softReset = function (params){
|
||||
Terminal.prototype.softReset = function (){
|
||||
this.cursorHidden = false;
|
||||
this.insertMode = false;
|
||||
this.originMode = false;
|
||||
|
@@ -13,6 +13,7 @@ module.exports = function (Terminal){
|
||||
// http://vt100.net/annarbor/aaa-ug/section6.html
|
||||
Terminal.prototype.tabClear = function (params){
|
||||
var param = params[0];
|
||||
|
||||
if (param <= 0) {
|
||||
delete this.tabs[this.x];
|
||||
} else if (param === 3) {
|
||||
|
Reference in New Issue
Block a user