Terminal class
Terminal is an interface to interact with command line applications. It translates escape sequences from the application into updates to the buffer and events such as onTitleChange or onBell, as well as translating user input into escape sequences that the application can understand.
- Implemented types
Constructors
-
Terminal({int maxLines = 1000, void onBell()?, void onTitleChange(String title)?, void onIconChange(String icon)?, void onOutput(String data)?, void onResize(int width, int height, int pixelWidth, int pixelHeight)?, TerminalTargetPlatform platform = TerminalTargetPlatform.unknown, TerminalInputHandler? inputHandler = defaultInputHandler, TerminalMouseHandler? mouseHandler = defaultMouseHandler, bool reflowEnabled = true, Set<
int> ? wordSeparators})
Properties
- altBuffer → Buffer
-
no setter
- altBufferMouseScrollMode → bool
-
no setteroverride
- appKeypadMode → bool
-
no setteroverride
- autoWrapMode → bool
-
no setteroverride
- bracketedPasteMode → bool
-
no setteroverride
- buffer → Buffer
-
Current active buffer of the terminal. This is initially mainBuffer and
can be switched back and forth from altBuffer to mainBuffer when
the underlying program requests it.
no setter
- cursor → CursorStyle
-
no setteroverride
- cursorBlinkMode → bool
-
no setteroverride
- cursorKeysMode → bool
-
no setteroverride
- cursorVisibleMode → bool
-
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- inputHandler ↔ TerminalInputHandler?
-
The TerminalInputHandler used by this terminal. defaultInputHandler is
used when not specified. User of this class can provide their own
implementation of TerminalInputHandler or extend defaultInputHandler
with CascadeInputHandler.
getter/setter pair
- insertMode → bool
-
no setteroverride
- isUsingAltBuffer → bool
-
no setter
- lineFeedMode → bool
-
no setteroverride
-
lines
→ CircularList<
BufferLine> -
Lines of the active buffer.
no setter
-
listeners
→ Set<
void Function()> -
finalinherited
- mainBuffer → Buffer
-
no setter
- maxLines → int
-
The number of lines that the scrollback buffer can hold. If the buffer
exceeds this size, the lines at the top of the buffer will be removed.
final
- mouseHandler ↔ TerminalMouseHandler?
-
getter/setter pair
- mouseMode → MouseMode
-
no setteroverride
- mouseReportMode → MouseReportMode
-
no setteroverride
- onBell ↔ void Function()?
-
Function that is called when the program requests the terminal to ring
the bell. If not set, the terminal will do nothing.
getter/setter pair
- onIconChange ↔ void Function(String icon)?
-
Function that is called when the program requests the terminal to change
the icon of the window.
icon
is the name of the icon.getter/setter pair - onOutput ↔ void Function(String data)?
-
Function that is called when the terminal emits data to the underlying
program. This is typically caused by user inputs from textInput,
keyInput, mouseInput, or paste.
getter/setter pair
- onResize ↔ void Function(int width, int height, int pixelWidth, int pixelHeight)?
-
Function that is called when the dimensions of the terminal change.
getter/setter pair
- onTitleChange ↔ void Function(String title)?
-
Function that is called when the program requests the terminal to change
the title of the window to
title
.getter/setter pair - originMode → bool
-
no setteroverride
- platform → TerminalTargetPlatform
-
Flag to toggle os specific behaviors.
final
- reflowEnabled ↔ bool
-
Whether the terminal performs reflow when the viewport size changes or
simply truncates lines. true by default.
getter/setter pairoverride-getter
- reportFocusMode → bool
-
no setteroverride
- reverseDisplayMode → bool
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- viewHeight → int
-
Number of rows in this terminal.
no setteroverride
- viewWidth → int
-
Number of cells in a terminal row.
no setteroverride
-
wordSeparators
→ Set<
int> ? -
Characters that break selection when double clicking. If not set, the
Buffer.defaultWordSeparators will be used.
final
Methods
-
addListener(
void listener()) → void -
inherited
-
backspaceReturn(
) → void -
override
-
bell(
) → void -
override
-
carriageReturn(
) → void -
override
-
charInput(
int charCode, {bool alt = false, bool ctrl = false}) → bool - Similary to keyInput, but takes a character as input instead of a TerminalKey.
-
clearAllTabStops(
) → void -
override
-
clearAltBuffer(
) → void -
override
-
clearTabStopUnderCursor(
) → void -
override
-
cursorNextLine(
int amount) → void -
override
-
cursorPrecedingLine(
int amount) → void -
override
-
deleteChars(
int amount) → void -
override
-
deleteLines(
int amount) → void -
override
-
designateCharset(
int charset) → void -
override
-
eraseChars(
int amount) → void -
override
-
eraseDisplay(
) → void -
override
-
eraseDisplayAbove(
) → void -
override
-
eraseDisplayBelow(
) → void -
override
-
eraseLine(
) → void -
override
-
eraseLineLeft(
) → void -
override
-
eraseLineRight(
) → void -
override
-
eraseScrollbackOnly(
) → void -
override
-
index(
) → void -
override
-
insertBlankChars(
int amount) → void -
override
-
insertLines(
int amount) → void -
override
-
keyInput(
TerminalKey key, {bool shift = false, bool alt = false, bool ctrl = false}) → bool - Sends a key event to the underlying program.
-
lineFeed(
) → void -
override
-
mouseInput(
TerminalMouseButton button, TerminalMouseButtonState buttonState, CellOffset position) → bool -
moveCursorX(
int offset) → void -
override
-
moveCursorY(
int n) → void -
override
-
nextLine(
) → void -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
inherited
-
paste(
String text) → void - Similar to textInput, except that when the program tells the terminal that it supports bracketedPasteMode, the text is wrapped in escape sequences to indicate that it is a paste operation. Prefer this method over textInput when pasting text.
-
removeListener(
void listener()) → void -
inherited
-
repeatPreviousCharacter(
int count) → void -
override
-
resetBackground(
) → void -
override
-
resetCursorStyle(
) → void -
override
-
resetForeground(
) → void -
override
-
resize(
int newWidth, int newHeight, [int? pixelWidth, int? pixelHeight]) → void -
Resize the terminal screen.
newWidth
andnewHeight
should be greater than 0. Text reflow is currently not implemented and will be avaliable in the future.override -
restoreCursor(
) → void -
override
-
reverseIndex(
) → void -
override
-
saveCursor(
) → void -
override
-
scrollDown(
int amount) → void -
override
-
scrollUp(
int amount) → void -
override
-
sendCursorPosition(
) → void -
override
-
sendOperatingStatus(
) → void -
override
-
sendPrimaryDeviceAttributes(
) → void -
override
-
sendSecondaryDeviceAttributes(
) → void -
override
-
sendSize(
) → void -
override
-
sendTertiaryDeviceAttributes(
) → void -
override
-
setAltBufferMouseScrollMode(
bool enabled) → void -
override
-
setAppKeypadMode(
bool enabled) → void -
override
-
setAutoWrapMode(
bool enabled) → void -
override
-
setBackgroundColor16(
int color) → void -
override
-
setBackgroundColor256(
int index) → void -
override
-
setBackgroundColorRgb(
int r, int g, int b) → void -
override
-
setBracketedPasteMode(
bool enabled) → void -
override
-
setColumnMode(
bool enabled) → void -
override
-
setCursor(
int x, int y) → void -
override
-
setCursorBlink(
) → void -
override
-
setCursorBlinkMode(
bool enabled) → void -
override
-
setCursorBold(
) → void -
override
-
setCursorFaint(
) → void -
override
-
setCursorInverse(
) → void -
override
-
setCursorInvisible(
) → void -
override
-
setCursorItalic(
) → void -
override
-
setCursorKeysMode(
bool enabled) → void -
override
-
setCursorStrikethrough(
) → void -
override
-
setCursorUnderline(
) → void -
override
-
setCursorVisibleMode(
bool enabled) → void -
override
-
setCursorX(
int x) → void -
override
-
setCursorY(
int y) → void -
override
-
setForegroundColor16(
int color) → void -
override
-
setForegroundColor256(
int index) → void -
override
-
setForegroundColorRgb(
int r, int g, int b) → void -
override
-
setIconName(
String name) → void -
override
-
setInsertMode(
bool enabled) → void -
override
-
setLineFeedMode(
bool enabled) → void -
override
-
setMargins(
int top, [int? bottom]) → void -
override
-
setMouseMode(
MouseMode mode) → void -
override
-
setMouseReportMode(
MouseReportMode mode) → void -
override
-
setOriginMode(
bool enabled) → void -
override
-
setReportFocusMode(
bool enabled) → void -
override
-
setReverseDisplayMode(
bool enabled) → void -
override
-
setTapStop(
) → void -
override
-
setTitle(
String name) → void -
override
-
setUnknownDecMode(
int mode, bool enabled) → void -
override
-
setUnknownMode(
int mode, bool enabled) → void -
override
-
shiftIn(
) → void -
override
-
shiftOut(
) → void -
override
-
tab(
) → void -
override
-
textInput(
String text) → void - Sends regular text input to the underlying program.
-
toString(
) → String -
A string representation of this object.
override
-
unknownCSI(
int finalByte) → void -
override
-
unknownOSC(
String ps) → void -
override
-
unknownSBC(
int char) → void -
override
-
unkownEscape(
int char) → void -
override
-
unsetCursorBlink(
) → void -
override
-
unsetCursorBold(
) → void -
override
-
unsetCursorFaint(
) → void -
override
-
unsetCursorInverse(
) → void -
override
-
unsetCursorInvisible(
) → void -
override
-
unsetCursorItalic(
) → void -
override
-
unsetCursorStrikethrough(
) → void -
override
-
unsetCursorUnderline(
) → void -
override
-
unsupportedStyle(
int param) → void -
override
-
useAltBuffer(
) → void -
override
-
useMainBuffer(
) → void -
override
-
write(
String data) → void -
Writes the data from the underlying program to the terminal. Calling this
updates the states of the terminal and emits events such as onBell or
onTitleChange when the escape sequences in
data
request it. -
writeChar(
int char) → void -
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited