update files

This commit is contained in:
nuintun
2015-11-25 09:42:21 +08:00
parent d50a32f882
commit d9d77434d6
9 changed files with 196 additions and 14 deletions

View File

@@ -74,6 +74,44 @@ module.exports = function (Terminal){
this.updateRange(this.scrollBottom);
};
// CSI P m SP }
// Insert P s Column(s) (default = 1) (DECIC), VT420 and up.
// NOTE: xterm doesn't enable this code by default.
Terminal.prototype.insertColumns = function (params){
var param = params[0];
var l = this.ybase + this.rows;
var ch = [this.eraseAttr(), ' ']; // xterm
var i;
while (param--) {
for (i = this.ybase; i < l; i++) {
this.lines[i].splice(this.x + 1, 0, ch);
this.lines[i].pop();
}
}
this.maxRange();
};
// CSI P m SP ~
// Delete P s Column(s) (default = 1) (DECDC), VT420 and up
// NOTE: xterm doesn't enable this code by default.
Terminal.prototype.deleteColumns = function (params){
var param = params[0];
var l = this.ybase + this.rows;
var ch = [this.eraseAttr(), ' ']; // xterm
var i;
while (param--) {
for (i = this.ybase; i < l; i++) {
this.lines[i].splice(this.x, 1);
this.lines[i].push(ch);
}
}
this.maxRange();
};
// CSI Ps P
// Delete Ps Character(s) (default = 1) (DCH).
Terminal.prototype.deleteChars = function (params){

View File

@@ -0,0 +1,33 @@
/**
* Created by nuintun on 2015/11/25.
*/
'use strict';
module.exports = function (Terminal){
// CSI Ps S Scroll up Ps lines (default = 1) (SU).
Terminal.prototype.scrollUp = function (params){
var param = params[0] || 1;
while (param--) {
this.lines.splice(this.ybase + this.scrollTop, 1);
this.lines.splice(this.ybase + this.scrollBottom, 0, this.blankLine());
}
this.updateRange(this.scrollTop);
this.updateRange(this.scrollBottom);
};
// CSI Ps T Scroll down Ps lines (default = 1) (SD).
Terminal.prototype.scrollDown = function (params){
var param = params[0] || 1;
while (param--) {
this.lines.splice(this.ybase + this.scrollBottom, 1);
this.lines.splice(this.ybase + this.scrollTop, 0, this.blankLine());
}
this.updateRange(this.scrollTop);
this.updateRange(this.scrollBottom);
};
};