Terminal class

Terminal represents a terminal screen that can be manipulated and drawn to.

It manages a Buffer representing the screen state, handles input event decoding, and provides methods for drawing text, shapes, and images.

Upstream: third_party/ultraviolet/terminal.go (Terminal).

Implemented types

Constructors

Terminal({Stream<List<int>>? input, IOSink? output, List<String>? env})

Properties

buffer Buffer
The backing Buffer for this terminal.
no setter
capabilities TerminalCapabilities
final
events Stream<Event>
A stream of decoded terminal Events.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bestImageDrawableForTerminal(Image image, {int? columns, int? rows}) → Drawable
Returns the best Drawable for the given image based on this terminal's capabilities.
bounds() Rectangle
The bounding rectangle of the terminal screen.
override
cellAt(int x, int y) Cell?
Returns the Cell at the given x and y coordinates.
override
clear() → void
Clears the terminal buffer.
clearScreen() → void
Clears the physical screen on the next draw.
clone() Buffer
Returns a clone of the current terminal buffer.
cloneArea(Rectangle area) Buffer?
Returns a clone of the specified area of the terminal buffer.
disableBracketedPaste() → void
Disables bracketed paste mode.
disableFocusReporting() → void
Disables focus reporting.
disableKeyboardEnhancements() → void
Disables keyboard enhancements (Kitty Keyboard Protocol).
disableMouse() → void
Disables mouse tracking.
draw() → void
Draws the current buffer state to the terminal.
enableBracketedPaste() → void
Enables bracketed paste mode.
enableFocusReporting() → void
Enables focus reporting.
enableKeyboardEnhancements(int flags) → void
Enables keyboard enhancements (Kitty Keyboard Protocol) with the specified flags.
enableMouse() → void
Enables mouse tracking.
enterAltScreen() → void
Enters the alternate screen buffer.
exitAltScreen() → void
Exits the alternate screen buffer.
fill(Cell? cell) → void
Fills the entire terminal screen with the given cell.
fillArea(Cell? cell, Rectangle area) → void
Fills the specified area with the given cell.
flush() → void
Flushes any pending output to the terminal.
getSize() Future<Size>
Returns the current size of the terminal.
hideCursor() → void
Hides the terminal cursor.
moveTo(int x, int y) → void
Moves the cursor to the given x and y position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prependString(String s) → void
Adds the given string to the top of the terminal screen.
queryCapabilities() → void
Queries the terminal for its capabilities.
resize(int width, int height) → void
Resizes the terminal buffer and renderer.
setBackspace(bool v) → void
Sets whether to use backspace as a movement optimization.
setCell(int x, int y, Cell? cell) → void
Sets the cell at the given x and y coordinates.
override
setColorProfile(Profile profile) → void
Sets the color profile to use for downsampling colors.
setEscTimeout(Duration d) → void
Sets the escape sequence timeout.
setFullscreen(bool v) → void
Sets whether the terminal is in fullscreen mode.
setHasTab(bool v) → void
Sets whether to use hard tabs as a movement optimization.
setRelativeCursor(bool v) → void
Sets whether to use relative cursor movements.
setScrollOptim(bool v) → void
Sets whether to use scroll optimizations.
setTabStops(int width) → void
Sets the tab stops for the terminal and enables hard tabs movement optimizations.
showCursor() → void
Shows the terminal cursor.
start() Future<void>
Starts the terminal session.
stop() Future<void>
Stops the terminal session and restores the original state.
toString() String
A string representation of this object.
inherited
widthMethod() → WidthMethod
The method used to calculate character widths.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

bestImageDrawable(Image image, {required TerminalCapabilities capabilities, int? columns, int? rows}) → Drawable
Returns the best Drawable for the given image based on terminal capabilities.