From 0d059308450dbe9a122b61b7a9424b12ed25cf79 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Thu, 8 Aug 2013 22:38:41 -0500 Subject: [PATCH] Added additional escape sequences defined in ECMA-48. 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. --- .../main/java/org/fusesource/jansi/Ansi.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/jansi/src/main/java/org/fusesource/jansi/Ansi.java b/jansi/src/main/java/org/fusesource/jansi/Ansi.java index 6d42d8d5..5e93ceac 100644 --- a/jansi/src/main/java/org/fusesource/jansi/Ansi.java +++ b/jansi/src/main/java/org/fusesource/jansi/Ansi.java @@ -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; @@ -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; @@ -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); } @@ -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()); }