Skip to content

Commit

Permalink
Added additional escape sequences defined in ECMA-48.
Browse files Browse the repository at this point in the history
Adds:

* cursorToColumn: Absolute columar positioning of the cursor,
* cursorUpLine: Move the cursor up one or more lines, and move it to the
  beginning of the line.
* cursorDownLine: Move the cursor down one or more lines, and move it to the
  beginning of the line.
  • Loading branch information
jdbernard committed Aug 9, 2013
1 parent 9bab505 commit 0d05930
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions jansi/src/main/java/org/fusesource/jansi/Ansi.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ public Ansi cursor(int x, int y) {
return this;
}

@Override
public Ansi cursorToColumn(int x) {
return this;
}

@Override
public Ansi cursorUp(int y) {
return this;
Expand All @@ -237,6 +242,26 @@ public Ansi cursorLeft(int x) {
return this;
}

@Override
public Ansi cursorDownLine() {
return this;
}

@Override
public Ansi cursorDownLine(final int n) {
return this;
}

@Override
public Ansi cursorUpLine() {
return this;
}

@Override
public Ansi cursorUpLine(final int n) {
return this;
}

@Override
public Ansi eraseScreen() {
return this;
Expand Down Expand Up @@ -339,6 +364,10 @@ public Ansi cursor(final int x, final int y) {
return appendEscapeSequence('H', x, y);
}

public Ansi cursorToColumn(final int x) {
return appendEscapeSequence('G', x);
}

public Ansi cursorUp(final int y) {
return appendEscapeSequence('A', y);
}
Expand All @@ -355,6 +384,22 @@ public Ansi cursorLeft(final int x) {
return appendEscapeSequence('D', x);
}

public Ansi cursorDownLine() {
return appendEscapeSequence('E');
}

public Ansi cursorDownLine(final int n) {
return appendEscapeSequence('E', n);
}

public Ansi cursorUpLine() {
return appendEscapeSequence('F');
}

public Ansi cursorUpLine(final int n) {
return appendEscapeSequence('F', n);
}

public Ansi eraseScreen() {
return appendEscapeSequence('J',Erase.ALL.value());
}
Expand Down

0 comments on commit 0d05930

Please sign in to comment.