Package org.jline.utils
Class Display
- java.lang.Object
-
- org.jline.utils.Display
-
public class Display extends java.lang.Object
Handle display and visual cursor.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
canScroll
private int
columns
private int
columns1
protected java.util.Map<InfoCmp.Capability,java.lang.Integer>
cost
protected boolean
cursorDownIsNewLine
protected int
cursorPos
protected boolean
delayedWrapAtEol
protected boolean
delayLineWrap
protected boolean
fullScreen
protected java.util.List<AttributedString>
oldLines
protected boolean
reset
protected int
rows
protected Terminal
terminal
protected boolean
wrapAtEol
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
can(InfoCmp.Capability single, InfoCmp.Capability multi)
void
clear()
Clears the whole screen.private int
computeCost(InfoCmp.Capability cap)
private int
cost(InfoCmp.Capability cap)
boolean
delayLineWrap()
If cursor is at right margin, don't wrap immediately.protected boolean
deleteChars(int nb)
protected boolean
deleteLines(int nb)
protected boolean
insertChars(int nb)
protected boolean
insertLines(int nb)
private static int[]
longestCommon(java.util.List<AttributedString> l1, java.util.List<AttributedString> l2)
protected int
moveVisualCursorTo(int i1)
protected void
moveVisualCursorTo(int targetPos, java.util.List<AttributedString> newLines)
protected boolean
perform(InfoCmp.Capability single, InfoCmp.Capability multi, int nb)
(package private) void
rawPrint(char c, int num)
(package private) void
rawPrint(int c)
(package private) void
rawPrint(AttributedString str)
void
reset()
void
resize(int rows, int columns)
void
setDelayLineWrap(boolean v)
void
update(java.util.List<AttributedString> newLines, int targetCursorPos)
Update the display according to the new lines and flushes the output.void
update(java.util.List<AttributedString> newLines, int targetCursorPos, boolean flush)
Update the display according to the new lines.void
updateAnsi(java.util.List<java.lang.String> newLines, int targetCursorPos)
int
wcwidth(java.lang.String str)
-
-
-
Field Detail
-
terminal
protected final Terminal terminal
-
fullScreen
protected final boolean fullScreen
-
oldLines
protected java.util.List<AttributedString> oldLines
-
cursorPos
protected int cursorPos
-
columns
private int columns
-
columns1
private int columns1
-
rows
protected int rows
-
reset
protected boolean reset
-
delayLineWrap
protected boolean delayLineWrap
-
cost
protected final java.util.Map<InfoCmp.Capability,java.lang.Integer> cost
-
canScroll
protected final boolean canScroll
-
wrapAtEol
protected final boolean wrapAtEol
-
delayedWrapAtEol
protected final boolean delayedWrapAtEol
-
cursorDownIsNewLine
protected final boolean cursorDownIsNewLine
-
-
Constructor Detail
-
Display
public Display(Terminal terminal, boolean fullscreen)
-
-
Method Detail
-
delayLineWrap
public boolean delayLineWrap()
If cursor is at right margin, don't wrap immediately. Seeorg.jline.reader.LineReader.Option#DELAY_LINE_WRAP
.- Returns:
true
if line wrap is delayed,false
otherwise
-
setDelayLineWrap
public void setDelayLineWrap(boolean v)
-
resize
public void resize(int rows, int columns)
-
reset
public void reset()
-
clear
public void clear()
Clears the whole screen. Use this method only when using full-screen / application mode.
-
updateAnsi
public void updateAnsi(java.util.List<java.lang.String> newLines, int targetCursorPos)
-
update
public void update(java.util.List<AttributedString> newLines, int targetCursorPos)
Update the display according to the new lines and flushes the output.- Parameters:
newLines
- the lines to displaytargetCursorPos
- desired cursor position - see Size.cursorPos.
-
update
public void update(java.util.List<AttributedString> newLines, int targetCursorPos, boolean flush)
Update the display according to the new lines.- Parameters:
newLines
- the lines to displaytargetCursorPos
- desired cursor position - see Size.cursorPos.flush
- whether the output should be flushed or not
-
deleteLines
protected boolean deleteLines(int nb)
-
insertLines
protected boolean insertLines(int nb)
-
insertChars
protected boolean insertChars(int nb)
-
deleteChars
protected boolean deleteChars(int nb)
-
can
protected boolean can(InfoCmp.Capability single, InfoCmp.Capability multi)
-
perform
protected boolean perform(InfoCmp.Capability single, InfoCmp.Capability multi, int nb)
-
cost
private int cost(InfoCmp.Capability cap)
-
computeCost
private int computeCost(InfoCmp.Capability cap)
-
longestCommon
private static int[] longestCommon(java.util.List<AttributedString> l1, java.util.List<AttributedString> l2)
-
moveVisualCursorTo
protected void moveVisualCursorTo(int targetPos, java.util.List<AttributedString> newLines)
-
moveVisualCursorTo
protected int moveVisualCursorTo(int i1)
-
rawPrint
void rawPrint(char c, int num)
-
rawPrint
void rawPrint(int c)
-
rawPrint
void rawPrint(AttributedString str)
-
wcwidth
public int wcwidth(java.lang.String str)
-
-