Package org.jline.utils
Class AttributedStringBuilder
- java.lang.Object
-
- org.jline.utils.AttributedCharSequence
-
- org.jline.utils.AttributedStringBuilder
-
- All Implemented Interfaces:
java.lang.Appendable,java.lang.CharSequence
public class AttributedStringBuilder extends AttributedCharSequence implements java.lang.Appendable
Attributed string builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAttributedStringBuilder.TabStops-
Nested classes/interfaces inherited from class org.jline.utils.AttributedCharSequence
AttributedCharSequence.ForceMode
-
-
Field Summary
Fields Modifier and Type Field Description private char[]bufferprivate AttributedStylecurrentprivate intlastLineLengthprivate intlengthprivate long[]styleprivate AttributedStringBuilder.TabStopstabs-
Fields inherited from class org.jline.utils.AttributedCharSequence
DISABLE_ALTERNATE_CHARSET, TRUE_COLORS
-
-
Constructor Summary
Constructors Constructor Description AttributedStringBuilder()AttributedStringBuilder(int capacity)
-
Method Summary
-
Methods inherited from class org.jline.utils.AttributedCharSequence
codePointAt, codePointBefore, codePointCount, columnLength, columnSplitLength, columnSplitLength, columnSubSequence, contains, isHidden, print, println, rgbColor, roundColor, roundRgbColor, runLimit, runStart, substring, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAnsi, toAttributedString, toString
-
-
-
-
Field Detail
-
buffer
private char[] buffer
-
style
private long[] style
-
length
private int length
-
tabs
private AttributedStringBuilder.TabStops tabs
-
lastLineLength
private int lastLineLength
-
current
private AttributedStyle current
-
-
Method Detail
-
append
public static AttributedString append(java.lang.CharSequence... strings)
-
length
public int length()
- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfacejava.lang.CharSequence- Overrides:
charAtin classAttributedCharSequence
-
styleAt
public AttributedStyle styleAt(int index)
- Specified by:
styleAtin classAttributedCharSequence
-
styleCodeAt
long styleCodeAt(int index)
- Overrides:
styleCodeAtin classAttributedCharSequence
-
buffer
protected char[] buffer()
- Specified by:
bufferin classAttributedCharSequence
-
offset
protected int offset()
- Specified by:
offsetin classAttributedCharSequence
-
subSequence
public AttributedString subSequence(int start, int end)
- Specified by:
subSequencein interfacejava.lang.CharSequence- Specified by:
subSequencein classAttributedCharSequence
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq)
- Specified by:
appendin interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq, int start, int end)
- Specified by:
appendin interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(char c)
- Specified by:
appendin interfacejava.lang.Appendable
-
append
public AttributedStringBuilder append(java.lang.CharSequence csq, AttributedStyle style)
-
style
public AttributedStringBuilder style(AttributedStyle style)
-
style
public AttributedStringBuilder style(java.util.function.Function<AttributedStyle,AttributedStyle> style)
-
styled
public AttributedStringBuilder styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.lang.CharSequence cs)
-
styled
public AttributedStringBuilder styled(AttributedStyle style, java.lang.CharSequence cs)
-
styled
public AttributedStringBuilder styled(java.util.function.Function<AttributedStyle,AttributedStyle> style, java.util.function.Consumer<AttributedStringBuilder> consumer)
-
style
public AttributedStyle style()
-
append
public AttributedStringBuilder append(AttributedString str)
-
append
public AttributedStringBuilder append(AttributedString str, int start, int end)
-
append
public AttributedStringBuilder append(AttributedCharSequence str)
-
append
public AttributedStringBuilder append(AttributedCharSequence str, int start, int end)
-
ensureCapacity
protected void ensureCapacity(int nl)
-
appendAnsi
public void appendAnsi(java.lang.String ansi)
-
ansiAppend
public AttributedStringBuilder ansiAppend(java.lang.String ansi)
-
insertTab
protected void insertTab(AttributedStyle s)
-
setLength
public void setLength(int l)
-
tabs
public AttributedStringBuilder tabs(int tabsize)
Set the number of spaces a tab is expanded to. Tab size cannot be changed after text has been added to prevent inconsistent indentation. If tab size is set to 0, tabs are not expanded (the default).- Parameters:
tabsize- Spaces per tab or 0 for no tab expansion. Must be non-negative- Returns:
- this
-
tabs
public AttributedStringBuilder tabs(java.util.List<java.lang.Integer> tabs)
-
styleMatches
public AttributedStringBuilder styleMatches(java.util.regex.Pattern pattern, AttributedStyle s)
-
styleMatches
public AttributedStringBuilder styleMatches(java.util.regex.Pattern pattern, java.util.List<AttributedStyle> styles)
-
-