1 | 'use strict';
|
2 |
|
3 | module.exports = function (Terminal) {
|
4 | Terminal.prototype.eraseRight = function(x, y) {
|
5 | var line = this.lines[this.ybase + y],
|
6 | ch = [this.curAttr, ' '];
|
7 |
|
8 | for (; x < this.cols; x++) {
|
9 | line[x] = ch;
|
10 | }
|
11 |
|
12 | this.updateRange(y);
|
13 | };
|
14 |
|
15 | Terminal.prototype.eraseLeft = function(x, y) {
|
16 | var line = this.lines[this.ybase + y],
|
17 | ch = [this.curAttr, ' '];
|
18 |
|
19 | x++;
|
20 | while (x--) line[x] = ch;
|
21 |
|
22 | this.updateRange(y);
|
23 | };
|
24 |
|
25 | Terminal.prototype.eraseLine = function(y) {
|
26 | this.eraseRight(0, y);
|
27 | };
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | Terminal.prototype.eraseInDisplay = function(params) {
|
40 | var j;
|
41 | switch (params[0]) {
|
42 | case 0:
|
43 | this.eraseRight(this.x, this.y);
|
44 | j = this.y + 1;
|
45 | for (; j < this.rows; j++) {
|
46 | this.eraseLine(j);
|
47 | }
|
48 | break;
|
49 | case 1:
|
50 | this.eraseLeft(this.x, this.y);
|
51 | j = this.y;
|
52 | while (j--) {
|
53 | this.eraseLine(j);
|
54 | }
|
55 | break;
|
56 | case 2:
|
57 | j = this.rows;
|
58 | while (j--) this.eraseLine(j);
|
59 | break;
|
60 | case 3:
|
61 | ;
|
62 | break;
|
63 | }
|
64 | };
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | Terminal.prototype.eraseInLine = function(params) {
|
76 | switch (params[0]) {
|
77 | case 0:
|
78 | this.eraseRight(this.x, this.y);
|
79 | break;
|
80 | case 1:
|
81 | this.eraseLeft(this.x, this.y);
|
82 | break;
|
83 | case 2:
|
84 | this.eraseLine(this.y);
|
85 | break;
|
86 | }
|
87 | };
|
88 | };
|