Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on.
For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html).
<sub>"Terminal Flow Diagram" is a derivative of ["computer keyboard 2"](https://openclipart.org/detail/2396/computer-keyboard-2) and ["monitor"](https://openclipart.org/detail/1637/monitor), from U.S. patent drawings, uploaded by [johnny_automatic](https://openclipart.org/artist/johnny_automatic), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).<sub/>
### (1) User Input
The user enters some data into the terminal, typically by typing something on the keyboard.
This corresponds to the `_gui_input()` method.
### (2) Terminal Output
The user input from (1) is processed by the terminal state machine and converted to the appropriate output.
For example, if the user were to press the downwards arrow key (↓), the terminal would then emit `data_sent()`
with the value `"\u001b[A"`.
### (3) Terminal Input
In the other direction, data can be sent to the terminal. This corresponds to the `write()` method.
### (4) Draw
The input from (3) is then interpreted by the terminal state machine and drawn to the screen.
For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal, then it would draw a green colored capital letter 'A' on the screen.
Emitted when a key is pressed. `data` is the data that would be emitted by the terminal via the [`data_sent()`](#sgnl-data_sent) signal and may vary based on the terminal's state. `event` is the event captured by Godot in the `_gui_input(event)` method.
Emitted when the terminal's size changes, typically in response to its `rect_size` changing.
`new_size.x` will be the number of columns and `new_size.y` will be the number of rows.
This information should be forwarded to a pseudoterminal, if it is connected, so that it can update its size accordingly.
## Enumerations
<aname="enum-update_mode"/> enum **UpdateMode**:
- **DISABLED** = **0** --- The terminal's `update()` method will never be called. No new cells will be drawn.
- **AUTO** = **1** --- Only changed cells will be drawn after `update()` is called, but will switch to **ALL_NEXT_FRAME** when mass redraws are required.
- **ALL** = **2** --- Every cell will be drawn on every `update()` call.
- **ALL_NEXT_FRAME** = **3** --- Draws every cell afetr the next `update()` call, then returns to **AUTO**.
## Property Descriptions
-<aname="prop-rows"/> [int] **rows**
| | |
|-----------|------------|
| *Default* | `2` |
| *Setter* | None |
| *Getter* | None |
The number of rows in the terminal's rect.
When using a monospace font, this is typically the number of characters that can fit from the top to the bottom.
It will automatically update as the Control's rect_size changes, and therefore shouldn't be used to set the size of the terminal directly.
---
-<aname="prop-cols"/> [int] **cols**
| | |
|-----------|------------|
| *Default* | `2` |
| *Setter* | None |
| *Getter* | None |
The number of columns in the terminal's rect.
When using a monospace font, this is typically the number of characters that can fit from one side to another.
It will automatically update as the Control's rect_size changes, and therefore shouldn't be used to set the size of the terminal directly.
---
-<aname="prop-bell_muted"/> [bool] **bell_muted**
| | |
|-----------|---------|
| *Default* | `false` |
| *Setter* | None |
| *Getter* | None |
If muted, no [`bell`](#sgnl-bell) signal will be emitted when the bell character (`"\u0007"`) is written to the terminal.
Determines which cells of the terminal will be updated when its state changes.
By default `AUTO` will only update cells that changed, but will update all cells (i.e. the entire screen) on major changes,
such as terminal resize.
If you are having trouble with the terminal not updating correctly or exhibiting artifacts, you can try remedying this by setting `update_mode` to `ALL`, however, this will have a negative impact on performance.
## Method Descriptions
-<aname="mthd-clear"/> void **clear****()**
Removes all but the bottommost row of the terminal including scrollback buffer.