Interface ITerminal
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
PreserveStateAddon,XTerm,XTermBase
The API that represents an xterm.js terminal.
-
Method Summary
Modifier and TypeMethodDescriptionvoidblur()Unfocus the terminal.voidclear()Clear the entire buffer, making the prompt line the new first line.voidClears the current terminal selection.voidfocus()Focus the terminal.Gets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js.Gets whether the terminal has an active selection.voidWrites text to the terminal, performing the necessary transformations for pasted text.voidrefresh(int start, int end) Tells the renderer to refresh terminal content between two rows (inclusive) at the next opportunity.voidreset()Perform a full reset (RIS, aka '\x1bc').voidresize(int columns, int rows) Resizes the terminal.voidscrollLines(int amount) Scroll the display of the terminalvoidscrollPages(int pageCount) Scroll the display of the terminal by a number of pages.voidScrolls the display of the terminal to the bottom.voidscrollToLine(int line) Scrolls to a line within the buffer.voidScrolls the display of the terminal to the top.voidselect(int column, int row, int length) Selects text within the terminal.voidSelects all text within the terminal.voidselectLines(int start, int end) Selects text in the buffer between 2 lines.voidWrite data to the terminal.voidWrites data to the terminal, followed by a break line character (\n).
-
Method Details
-
blur
void blur()Unfocus the terminal. -
focus
void focus()Focus the terminal. -
hasSelection
CompletableFuture<Boolean> hasSelection()Gets whether the terminal has an active selection. -
getSelection
CompletableFuture<String> getSelection()Gets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js. -
clearSelection
void clearSelection()Clears the current terminal selection. -
select
void select(int column, int row, int length) Selects text within the terminal.- Parameters:
column- The column the selection starts at.row- The row the selection starts at.length- The length of the selection.
-
selectAll
void selectAll()Selects all text within the terminal. -
selectLines
void selectLines(int start, int end) Selects text in the buffer between 2 lines.- Parameters:
start- The 0-based line index to select from (inclusive).end- The 0-based line index to select to (inclusive).
-
scrollLines
void scrollLines(int amount) Scroll the display of the terminal- Parameters:
amount- The number of lines to scroll down (negative scroll up).
-
scrollPages
void scrollPages(int pageCount) Scroll the display of the terminal by a number of pages.- Parameters:
pageCount- The number of pages to scroll (negative scrolls up).
-
scrollToTop
void scrollToTop()Scrolls the display of the terminal to the top. -
scrollToBottom
void scrollToBottom()Scrolls the display of the terminal to the bottom. -
scrollToLine
void scrollToLine(int line) Scrolls to a line within the buffer.- Parameters:
line- The 0-based line index to scroll to.
-
clear
void clear()Clear the entire buffer, making the prompt line the new first line. -
write
Write data to the terminal.- Parameters:
data- The data to write to the terminal.
-
writeln
Writes data to the terminal, followed by a break line character (\n).- Parameters:
data- The data to write to the terminal. This can either be raw bytes given as Uint8Array from the pty or a string. Raw bytes will always be treated as UTF-8 encoded, string data as UTF-16.
-
paste
Writes text to the terminal, performing the necessary transformations for pasted text.- Parameters:
data- The text to write to the terminal.
-
refresh
void refresh(int start, int end) Tells the renderer to refresh terminal content between two rows (inclusive) at the next opportunity.- Parameters:
start- The row to start from (between 0 and this.rows - 1).end- The row to end at (between start and this.rows - 1).
-
reset
void reset()Perform a full reset (RIS, aka '\x1bc'). -
resize
void resize(int columns, int rows) Resizes the terminal. Set the number of columns and rows in the terminal.
-