- java.lang.Object
-
- org.jline.utils.Status
-
public class Status extends java.lang.ObjectManages a status bar at the bottom of the terminal.The Status class provides functionality for displaying and managing a status bar at the bottom of the terminal. It allows applications to show persistent status information to the user while still using the rest of the terminal for normal input and output.
Key features include:
- Support for multiple status lines
- Styled text with ANSI colors and attributes
- Automatic resizing based on terminal dimensions
- Optional border between main display and status area
- Ability to temporarily suspend the status display
The status bar is particularly useful for displaying persistent information such as:
- Application mode or state
- Current file or context
- Key bindings or available commands
- Error messages or notifications
This class is used by various JLine components to provide status information to the user without disrupting the main terminal interaction.
-
-
Field Summary
Fields Modifier and Type Field Description protected intborderprotected AttributedStringborderStringprotected Displaydisplayprotected java.util.List<AttributedString>linesprotected intscrollRegionprotected booleansupportedprotected booleansuspendedprotected Terminalterminal
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static java.util.Optional<Status>getExistingStatus(Terminal terminal)static StatusgetStatus(Terminal terminal)static StatusgetStatus(Terminal terminal, boolean create)voidhide()voidredraw()voidreset()voidresize()voidresize(Size size)Resize the status display to the provided terminal character-grid size and adjust terminal state accordingly.voidrestore()Therestore()call is the opposite ofsuspend()and will make the status bar be updated again.voidsetBorder(boolean border)intsize()voidsuspend()Thesuspendmethod is used when a full-screen.java.lang.StringtoString()voidupdate(java.util.List<AttributedString> lines)voidupdate(java.util.List<AttributedString> lines, boolean flush)Returnstrueif the cursor may be misplaced and should be updated.
-
-
-
Field Detail
-
terminal
protected final Terminal terminal
-
supported
protected final boolean supported
-
suspended
protected boolean suspended
-
borderString
protected AttributedString borderString
-
border
protected int border
-
display
protected Display display
-
lines
protected java.util.List<AttributedString> lines
-
scrollRegion
protected int scrollRegion
-
-
Constructor Detail
-
Status
public Status(Terminal terminal)
-
-
Method Detail
-
close
public void close()
-
setBorder
public void setBorder(boolean border)
-
resize
public void resize()
-
resize
public void resize(Size size)
Resize the status display to the provided terminal character-grid size and adjust terminal state accordingly.If the status feature is supported and the supplied size is valid, this updates the internal display dimensions, recomputes and applies the scroll region reserved for the status area, and clears any leftover status output that may remain after the resize. The terminal cursor position is preserved across these changes. If the status feature is not supported or the size is invalid, this method is a no-op.
- Parameters:
size- the new terminal character-grid size to apply
-
reset
public void reset()
-
redraw
public void redraw()
-
hide
public void hide()
-
update
public void update(java.util.List<AttributedString> lines)
-
update
public void update(java.util.List<AttributedString> lines, boolean flush)
Returnstrueif the cursor may be misplaced and should be updated.
-
suspend
public void suspend()
Thesuspendmethod is used when a full-screen. If the status was not already suspended, the lines used by the status are cleared during this call.
-
restore
public void restore()
Therestore()call is the opposite ofsuspend()and will make the status bar be updated again. If the status was suspended, the lines used by the status will be drawn during this call.
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-