private void erasePrompt(PrintStream printStream) { printStream.print(ansi() .eraseLine(Ansi.Erase.BACKWARD).cursorLeft(PROMPT.length())); }
public void reprintLine(String line) { if (isRealTerminal()) { out.print(ansi().eraseLine(Erase.ALL).a(line).a('\n').toString()); } else { out.print('\r' + line); } out.flush(); lines++; }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given multiline. Make sure the specified line is not * terminated by linebreak. * * @param line - line to print */ private void reprintMultiLine(String line) { int numLines = line.split("\r\n|\r|\n").length; out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines += numLines; }
private void reprintMultiLine(String line) { int numLines = line.split("\r\n|\r|\n").length; out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines += numLines; } }
public static void reprintLine(PrintStream out, String line) { out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); }
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(); }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given line with the specified color. * * @param line - line to print * @param color - color for the line */ private void reprintLineWithColorAsBold(String line, Ansi.Color color) { out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset() .toString()); out.flush(); lines++; }
private void reprintLineWithColorAsBold(String line, Ansi.Color color) { out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset() .toString()); out.flush(); lines++; }
private void updateAnsiProgress(String imageId, String status, String progressMessage) { Map<String,Integer> imgLineMap = imageLines.get(); Integer line = imgLineMap.get(imageId); int diff = 0; if (line == null) { line = imgLineMap.size(); imgLineMap.put(imageId, line); } else { diff = imgLineMap.size() - line; } if (diff > 0) { print(ansi().cursorUp(diff).eraseLine(Ansi.Erase.ALL).toString()); } // Status with progress bars: (max length = 11, hence pad to 11) // Extracting // Downloading String progress = progressMessage != null ? progressMessage : ""; String msg = ansi() .fg(COLOR_PROGRESS_ID).a(imageId).reset().a(": ") .fg(COLOR_PROGRESS_STATUS).a(StringUtils.rightPad(status,11) + " ") .fg(COLOR_PROGRESS_BAR).a(progress).toString(); println(msg); if (diff > 0) { // move cursor back down to bottom print(ansi().cursorDown(diff - 1).toString()); } }
long fileSize = FileUtils.sizeOf(localFile); if (fileSize > nextLog) { System.err.print("\r" + ansi().eraseLine()); System.err.print(FileUtils.byteCountToDisplaySize(fileSize)); if (maxLength > 0) {
public void print(String s) { for ( ChatColor color : colors ) { s = s.replaceAll( "(?i)" + color.toString(), replacements.get( color ) ); } try { console.print( Ansi.ansi().eraseLine( Erase.ALL ).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() ); console.drawLine(); console.flush(); } catch ( IOException ex ) { } }
@Override public AnsiContext eraseForward() { delegate.eraseLine(Ansi.Erase.FORWARD); return this; }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given multiline. Make sure the specified line is not * terminated by linebreak. * * @param line - line to print */ private void reprintMultiLine(String line) { int numLines = line.split("\r\n|\r|\n").length; out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines += numLines; }
@Override public String delete() { console.out().print(ansi().eraseLine(Erase.FORWARD)); String r = delegate.delete(); if (r.equals(NEW_LINE) || r.equals(CARRIEGE_RETURN)) { redrawRestOfScreen(); } else { redrawRestOfLine(); } return r; }
public void reprintLine(String line) { if (isRealTerminal()) { out.print(ansi().eraseLine(Erase.ALL).a(line).a('\n').toString()); } else { out.print('\r' + line); } out.flush(); lines++; }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given line. * @param line - line to print */ public void reprintLine(String line) { out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush(); lines++; }
public void reprintLine(String line) { if (isRealTerminal()) { out.print(ansi().eraseLine(Erase.ALL).a(line).a('\n').toString()); } else { out.print('\r' + line); } out.flush(); lines++; }
/** * Renders the confirmation message on the screen. */ private void render() { System.out.println(""); System.out.println(ansi().eraseLine().cursorUp(2)); System.out.print(renderMessagePrompt(this.confirmChoice.getMessage()) + itemRenderer.renderConfirmChoiceOptions(this.confirmChoice) + " " + ansi().reset().a(calcResultValue() + " ").eraseLine()); System.out.flush(); renderHeight = 1; }
@Override public void clearLine() { print(new Ansi().eraseLine(Ansi.Erase.ALL).toString()); }
/** * NOTE: Use this method only if isUnixTerminal is true. * Erases the current line and prints the given line with the specified color. * * @param line - line to print * @param color - color for the line */ private void reprintLineWithColorAsBold(String line, Ansi.Color color) { out.print(ansi().eraseLine(Ansi.Erase.ALL).fg(color).bold().a(line).a('\n').boldOff().reset() .toString()); out.flush(); lines++; }