private void erasePrompt(PrintStream printStream) { printStream.print(ansi() .eraseLine(Ansi.Erase.BACKWARD).cursorLeft(PROMPT.length())); }
private Ansi moveDownToSkipPrompt() { return ansi() .cursorDown(1) .cursorLeft(PROMPT.length()); }
private Ansi erasePreviousLine(String categoryName) { int cursorMove = this.cursorMove; if (userInputActive) { cursorMove++; } if (cursorMove > 0) { int moveLeftLength = categoryName.length() + lastMessage.length(); if (userInputActive) { moveLeftLength += PROMPT.length(); } return ansi() .cursorUp(cursorMove) .cursorLeft(moveLeftLength) .eraseLine(FORWARD); } return ansi(); }
private void erasePrompt(PrintStream printStream) { printStream.print(ansi() .eraseLine(Ansi.Erase.BACKWARD).cursorLeft(PROMPT.length())); }
private Ansi moveDownToSkipPrompt() { return ansi() .cursorDown(1) .cursorLeft(PROMPT.length()); }
private Ansi erasePreviousLine(String categoryName) { int cursorMove = this.cursorMove; if (userInputActive) cursorMove++; if (cursorMove > 0) { int moveLeftLength = categoryName.length() + lastMessage.length(); if (userInputActive) { moveLeftLength += PROMPT.length(); } return ansi() .cursorUp(cursorMove) .cursorLeft(moveLeftLength) .eraseLine(FORWARD); } return ansi(); }
@Override public void cursorLeft(final int x) { print(new Ansi().cursorLeft(x).toString()); }
private void positionCursorAt(Cursor position, Ansi ansi) { if (writeCursor.row == position.row) { if (writeCursor.col == position.col) { return; } if (writeCursor.col < position.col) { ansi.cursorRight(position.col - writeCursor.col); } else { ansi.cursorLeft(writeCursor.col - position.col); } } else { if (writeCursor.col > 0) { ansi.cursorLeft(writeCursor.col); } if (writeCursor.row < position.row) { ansi.cursorUp(position.row - writeCursor.row); } else { ansi.cursorDown(writeCursor.row - position.row); } if (position.col > 0) { ansi.cursorRight(position.col); } } writeCursor.copyFrom(position); }
if (lineBuilder.length() > 0) { lineBuilder.delete(lineBuilder.length() - 1, lineBuilder.length()); console.out().print(Ansi.ansi().cursorLeft(1)); console.out().print(" "); console.out().print(Ansi.ansi().cursorLeft(1));