Skip to content

Commit

Permalink
Send both SCO and DEC command for save/restore cursor position (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Sep 29, 2023
1 parent 27a7bb5 commit b4aa448
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/main/java/org/fusesource/jansi/Ansi.java
Original file line number Diff line number Diff line change
Expand Up @@ -716,19 +716,45 @@ public Ansi scrollDown(final int rows) {
return rows > 0 ? appendEscapeSequence('T', rows) : rows < 0 ? scrollUp(-rows) : this;
}

@Deprecated
public Ansi restorCursorPosition() {
return restoreCursorPosition();
}

public Ansi saveCursorPosition() {
saveCursorPositionSCO();
return saveCursorPositionDEC();
}

// SCO command
public Ansi saveCursorPositionSCO() {
return appendEscapeSequence('s');
}

@Deprecated
public Ansi restorCursorPosition() {
return appendEscapeSequence('u');
// DEC command
public Ansi saveCursorPositionDEC() {
builder.append(FIRST_ESC_CHAR);
builder.append('7');
return this;
}

public Ansi restoreCursorPosition() {
restoreCursorPositionSCO();
return restoreCursorPositionDEC();
}

// SCO command
public Ansi restoreCursorPositionSCO() {
return appendEscapeSequence('u');
}

// DEC command
public Ansi restoreCursorPositionDEC() {
builder.append(FIRST_ESC_CHAR);
builder.append('8');
return this;
}

public Ansi reset() {
return a(Attribute.RESET);
}
Expand Down

0 comments on commit b4aa448

Please sign in to comment.