Skip to content

Commit

Permalink
Improve CSI J functionality
Browse files Browse the repository at this point in the history
CSI J is the escape sequence for clearing some part of the terminal
screen. The `clear` command uses this sequence to clear the terminal.
Improve how the sequence clears the screen by preserving the previous
value of the cursor in CSI H, the sequence for setting cursor position.
  • Loading branch information
jeremyramin committed Nov 26, 2015
1 parent 30849fc commit de1635f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -3615,6 +3615,7 @@ Terminal.prototype.cursorPos = function(params) {
col = this.cols - 1;
}

this.prevY = this.y;
this.x = col;
this.y = row;
};
Expand Down Expand Up @@ -3648,7 +3649,7 @@ Terminal.prototype.eraseInDisplay = function(params) {
}
break;
case 2:
j = this.rows;
j = this.prevY || this.rows;
while (j--)
{
this.lines.push(this.blankLine());
Expand Down

0 comments on commit de1635f

Please sign in to comment.