public String readLine() throws IOException { if (lines.isEmpty()) { String line = reader.readLine(); if (line == null) { return null; } if (line.isEmpty()) { lines.add(""); } else { builder.setLength(0); builder.appendAnsi(line); if (builder.length() > 0) { builder.style(builder.styleAt(builder.length() - 1)); } AttributedString str = builder.columnSubSequence(begin, end); str.columnSplitLength(maxLength) .stream() .map(AttributedString::toAnsi) .forEach(lines::add); } } return lines.remove(0); }
public String readLine() throws IOException { if (lines.isEmpty()) { String line = reader.readLine(); if (line == null) { return null; } if (line.isEmpty()) { lines.add(""); } else { builder.setLength(0); builder.appendAnsi(line); if (builder.length() > 0) { builder.style(builder.styleAt(builder.length() - 1)); } AttributedString str = builder.columnSubSequence(begin, end); str.columnSplitLength(maxLength) .stream() .map(AttributedString::toAnsi) .forEach(lines::add); } } return lines.remove(0); }
public static String substring(String text, int begin, int end, int tabs) throws IOException { AttributedStringBuilder sb = new AttributedStringBuilder(); sb.tabs(tabs); sb.appendAnsi(text); return sb.columnSubSequence(begin, end).toAnsi(); }
public static String substring(String text, int begin, int end, int tabs) throws IOException { AttributedStringBuilder sb = new AttributedStringBuilder(); sb.tabs(tabs); sb.appendAnsi(text); return sb.columnSubSequence(begin, end).toAnsi(); }