Finish CSI codes

This commit is contained in:
Daniel Imms
2017-01-12 21:58:50 -08:00
parent 9b66208029
commit f4846aa154
4 changed files with 170 additions and 770 deletions
+88
View File
@@ -405,6 +405,34 @@ export class InputHandler implements IInputHandler {
}
}
/**
* CSI Ps S Scroll up Ps lines (default = 1) (SU).
*/
public scrollUp(params: number[]): void {
let param = params[0] || 1;
while (param--) {
this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 1);
this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 0, this._terminal.blankLine());
}
// this.maxRange();
this._terminal.updateRange(this._terminal.scrollTop);
this._terminal.updateRange(this._terminal.scrollBottom);
}
/**
* CSI Ps T Scroll down Ps lines (default = 1) (SD).
*/
public scrollDown(params: number[]): void {
let param = params[0] || 1;
while (param--) {
this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollBottom, 1);
this._terminal.lines.splice(this._terminal.ybase + this._terminal.scrollTop, 0, this._terminal.blankLine());
}
// this.maxRange();
this._terminal.updateRange(this._terminal.scrollTop);
this._terminal.updateRange(this._terminal.scrollBottom);
}
/**
* CSI Ps X
* Erase Ps Character(s) (default = 1) (ECH).
@@ -426,6 +454,16 @@ export class InputHandler implements IInputHandler {
}
}
/**
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
*/
public cursorBackwardTab(params: number[]): void {
let param = params[0] || 1;
while (param--) {
this._terminal.x = this._terminal.prevStop();
}
}
/**
* CSI Pm ` Character Position Absolute
* [column] (default = [row,1]) (HPA).
@@ -457,6 +495,19 @@ export class InputHandler implements IInputHandler {
}
}
/**
* CSI Ps b Repeat the preceding graphic character Ps times (REP).
*/
public repeatPrecedingCharacter(params: number[]): void {
let param = params[0] || 1
, line = this._terminal.lines.get(this._terminal.ybase + this._terminal.y)
, ch = line[this._terminal.x - 1] || [this._terminal.defAttr, ' ', 1];
while (param--) {
line[this._terminal.x++] = ch;
}
}
/**
* CSI Ps c Send Device Attributes (Primary DA).
* Ps = 0 or omitted -> request attributes from terminal. The
@@ -574,6 +625,22 @@ export class InputHandler implements IInputHandler {
}
}
/**
* CSI Ps g Tab Clear (TBC).
* Ps = 0 -> Clear Current Column (default).
* Ps = 3 -> Clear All.
* Potentially:
* Ps = 2 -> Clear Stops on Line.
* http://vt100.net/annarbor/aaa-ug/section6.html
*/
public tabClear(params: number[]): void {
let param = params[0];
if (param <= 0) {
delete this._terminal.tabs[this._terminal.x];
} else if (param === 3) {
this._terminal.tabs = {};
}
}
/**
* CSI Pm h Set Mode (SM).
@@ -1214,6 +1281,27 @@ export class InputHandler implements IInputHandler {
}
}
/**
* CSI ! p Soft terminal reset (DECSTR).
* http://vt100.net/docs/vt220-rm/table4-10.html
*/
public softReset(params: number[]): void {
this._terminal.cursorHidden = false;
this._terminal.insertMode = false;
this._terminal.originMode = false;
this._terminal.wraparoundMode = false; // autowrap
this._terminal.applicationKeypad = false; // ?
this._terminal.viewport.syncScrollArea();
this._terminal.applicationCursor = false;
this._terminal.scrollTop = 0;
this._terminal.scrollBottom = this._terminal.rows - 1;
this._terminal.curAttr = this._terminal.defAttr;
this._terminal.x = this._terminal.y = 0; // ?
this._terminal.charset = null;
this._terminal.glevel = 0; // ??
this._terminal.charsets = [null]; // ??
}
/**
* CSI Ps ; Ps r
* Set Scrolling Region [top;bottom] (default = full size of win-