Interface Terminal
- All Superinterfaces:
AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTerminalListener
(ghidra.app.plugin.core.terminal.TerminalListener listener) Add a listener for terminal eventsvoid
close()
int
Get the maximum number of characters in each rowint
Get the cursor's current columnint
Get the cursor's current lineGet the text in the terminal, excluding the scroll-back bufferGet all the text in the terminal, including the scroll-back buffergetLineText
(int line) Get the given line's textgetRangeText
(int startCol, int startLine, int endCol, int endLine) Get the text in the given rangeint
getRows()
Get the maximum number of rows in the display (not counting scroll-back)int
Get the number of lines in the scroll-back bufferGet the pane's current sub titledefault void
injectDisplayOutput
(byte[] arr) void
Process the given buffer as if it were output by the terminal's application.boolean
Check whether the terminal is terminated or activevoid
removeTerminalListener
(ghidra.app.plugin.core.terminal.TerminalListener listener) Remove a listener for terminal eventsvoid
Fit the terminal's dimensions to the containing window.default void
setFixedSize
(int cols, int rows) void
setFixedSize
(short cols, short rows) Set the terminal size to the given dimensions, and do not resize it to the window.void
setMaxScrollBackRows
(int rows) Set the maximum size of the scroll-back buffer in linesvoid
setSubTitle
(String title) Set the pane's sub titlevoid
setTerminateAction
(Runnable action) Allow the user to terminate the session forcefullyvoid
Notify the terminal that its session has terminatedvoid
toFront()
Bring the terminal to the front of the UI
-
Method Details
-
addTerminalListener
void addTerminalListener(ghidra.app.plugin.core.terminal.TerminalListener listener) Add a listener for terminal events- Parameters:
listener
- the listener
-
removeTerminalListener
void removeTerminalListener(ghidra.app.plugin.core.terminal.TerminalListener listener) Remove a listener for terminal events- Parameters:
listener
- the listener
-
injectDisplayOutput
Process the given buffer as if it were output by the terminal's application.Warning: While implementations may synchronize to ensure the additional buffer is not processed at the same time as actual application input, there may not be any effort to ensure that the buffer is not injected in the middle of an escape sequence. Even if the injection is outside an escape sequence, this may still lead to unexpected behavior, since the injected output may be affected by or otherwise interfere with the application's control of the terminal's state. Generally, this should only be used for testing, or other cases when the caller knows it has exclusive control of the terminal.
- Parameters:
bb
- the buffer of bytes to inject
-
injectDisplayOutput
default void injectDisplayOutput(byte[] arr) - Parameters:
arr
- the array of bytes to inject- See Also:
-
setSubTitle
Set the pane's sub titleThe application may also set this sub title using an escape sequence.
- Parameters:
title
- the new sub title
-
getSubTitle
String getSubTitle()Get the pane's current sub title- Returns:
- the sub title
-
setFixedSize
void setFixedSize(short cols, short rows) Set the terminal size to the given dimensions, and do not resize it to the window.- Parameters:
cols
- the number of columnsrows
- the number of rows
-
setFixedSize
default void setFixedSize(int cols, int rows) - Parameters:
cols
- the number of columnsrows
- the number of rows- See Also:
-
setDynamicSize
void setDynamicSize()Fit the terminal's dimensions to the containing window. -
setMaxScrollBackRows
void setMaxScrollBackRows(int rows) Set the maximum size of the scroll-back buffer in linesThis only affects the primary buffer. The alternate buffer has no scroll-back.
- Parameters:
rows
- the number of scroll-back rows
-
getColumns
int getColumns()Get the maximum number of characters in each row- Returns:
- the column count
-
getRows
int getRows()Get the maximum number of rows in the display (not counting scroll-back)- Returns:
- the row count
-
getScrollBackRows
int getScrollBackRows()Get the number of lines in the scroll-back buffer- Returns:
- the size of the buffer in lines
-
getFullText
String getFullText()Get all the text in the terminal, including the scroll-back buffer- Returns:
- the full text
-
getDisplayText
String getDisplayText()Get the text in the terminal, excluding the scroll-back buffer- Returns:
- the display text
-
getLineText
Get the given line's textThe line at the top of the display has index 0. Lines in the scroll-back buffer have negative indices.
- Parameters:
line
- the index, 0 up- Returns:
- the text in the line
-
getRangeText
Get the text in the given rangeThe line at the top of the display has index 0. Lines in the scroll-back buffer have negative indices.
- Parameters:
startCol
- the first column to include in the starting linestartLine
- the first line to includeendCol
- the first column to exclude in the ending lineendLine
- the last line to include- Returns:
- the text in the given range
-
getCursorRow
int getCursorRow()Get the cursor's current lineLines are indexed 0 up where the top line of the display is 0. The cursor can never be in the scroll-back buffer.
- Returns:
- the line, 0 up, top to bottom
-
getCursorColumn
int getCursorColumn()Get the cursor's current column- Returns:
- the column, 0 up, left to right
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-
terminated
void terminated()Notify the terminal that its session has terminatedThe title and sub title are adjust and all listeners are removed. If/when the terminal is closed, it is permanently removed from the tool.
-
setTerminateAction
Allow the user to terminate the session forcefully- Parameters:
action
- the action to terminate the session, or null to remove the action
-
isTerminated
boolean isTerminated()Check whether the terminal is terminated or active- Returns:
- true for terminated, false for active
-
toFront
void toFront()Bring the terminal to the front of the UI
-