static int consoleWidth(String s) { return consoleWidth(new AnsiString(s)); }
static int consoleWidth(String s) { return consoleWidth(new AnsiString(s)); }
static int consoleWidth(String s) { return consoleWidth(new AnsiString(s)); }
@Override public int getLength(Object content) { return new AnsiString(content.toString()).length(); } }
static int consoleWidth(String s) { return consoleWidth(new AnsiString(s)); }
static int consoleWidth(String s) { return consoleWidth(new AnsiString(s)); }
result.append(c); if (c == '$') { AnsiString as = new AnsiString(result.toString()); String s = as.getPlain().toString(); s = s.replaceAll("\n", "<br>");
private String readLine(boolean firstLine) throws IOException { String line = null; int promptLength = new AnsiString(getPrompt()).length(); StringBuilder morePrompt = new StringBuilder(); for (int i = 0; i < promptLength - 5; i++) { morePrompt.append(" "); } morePrompt.append(color(BLUE, "...: ")); morePrompt.append(revertToDefaultColor()); while (line == null) { if (firstLine) { line = reader.readLine(getPrompt()); } else { line = reader.readLine(morePrompt.toString()); } if (line == null) { System.out.print("\nDo you really want to exit ([y]/n)? "); char input = (char) reader.readCharacter('y', 'n', (char) 10); if (input != 'n') { return null; } else { System.out.println(); System.out.println(); reader.flush(); } } } return line; }
private CharSequence render(final File file) { assert file != null; String name = file.getName(); if (file.isDirectory()) { name = ansi().fg(BLUE).a(name).a(File.separator).reset().toString(); } // else if (file.canExecute()) { // name = ansi().fg(GREEN).a(name).a("*").reset().toString(); // } if (file.isHidden()) { name = ansi().a(INTENSITY_FAINT).a(name).reset().toString(); } return new AnsiString(name); } }