Skip to content

Commit

Permalink
[341-ctrl-l-doesnt-clear-initial-rails-output]
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Stepanov committed Apr 14, 2010
1 parent d69ef28 commit b2ebb6a
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public class VT100Emulator implements ControlListener {
* in field {@link #ansiParameters}.
*/
private int nextAnsiParameter = 0;

private int lastCursorLine = -1;
private int lastCursorColumn = -1;

Reader fReader;

Expand Down Expand Up @@ -650,6 +653,8 @@ private void processAnsiCommand_G() {
* sequence parameters (default is the upper left corner of the screen).
*/
private void processAnsiCommand_H() {
lastCursorLine = text.getCursorLine();
lastCursorColumn = text.getCursorColumn();
moveCursor(getAnsiParameter(0) - 1, getAnsiParameter(1) - 1);
}

Expand Down Expand Up @@ -729,7 +734,18 @@ private void processAnsiCommand_J() {

case 2:
// Erase entire display.


if (text.getCursorLine() == 0 && text.getCursorColumn() == 0
&& lastCursorLine != -1 && lastCursorColumn != -1) {
moveCursor(lastCursorLine, lastCursorColumn);
for (int i = text.getLines(); i > 0; --i) {
text.processNewline();
}
moveCursor(0, 0);
lastCursorLine = -1;
lastCursorColumn = -1;

}
text.eraseAll();
break;

Expand Down

0 comments on commit b2ebb6a

Please sign in to comment.