Terminal class
#include <nxt/vterm.hpp>
Owning libvterm terminal screen model.
Public types
- struct ScreenSnapshot
- Dense copy of the current screen cells.
Constructors, destructors, conversion operators
Public functions
-
auto cursor() const → std::
optional<Cursor> noexcept - Return the cursor state when the underlying terminal state is valid.
-
auto get_cell(int row,
int col) const → std::
optional<Cell> - Return the cell at a zero-based row/column position.
-
auto get_row(int row) const → std::
vector<Cell> - Return visible cells from one terminal row.
-
auto get_row_text(int row) const → std::
string - Extract UTF-8 text for one row.
-
auto get_screen_text() const → std::
string - Extract UTF-8 text for the whole screen.
-
auto get_size() const → std::
pair<int, int> - Current terminal size as
{rows, cols}. -
auto get_text(int start_row,
int start_col,
int end_row,
int end_col) const → std::
string - Extract UTF-8 text from an inclusive rectangular cell range.
- void keyboard_key(VTermKey key, VTermModifier modifiers = VTERM_MOD_NONE) const
- Encode a special keypress through libvterm's keyboard encoder.
-
void keyboard_unichar(std::
uint32_t codepoint, VTermModifier modifiers = VTERM_MOD_NONE) const - Encode a Unicode keypress through libvterm's keyboard encoder.
- auto operator=(const Terminal&) → Terminal& deleted
- auto operator=(Terminal&& other) → Terminal& noexcept
- auto raw() const → VTerm* noexcept
- Raw libvterm handle for low-level integrations.
-
auto read_pending_output() const → std::
string - Read bytes libvterm wants to send back to the child PTY.
- void reset(bool hard = true)
- Reset the screen; a hard reset clears more terminal state.
- auto screen() const → VTermScreen* noexcept
- Raw libvterm screen handle for low-level integrations.
- void set_size(int rows, int cols)
- Resize the terminal, clamping both dimensions to at least one cell.
- auto snapshot() const → ScreenSnapshot
- Capture the current libvterm screen into a dense snapshot.
-
void write(std::
string_view data) const - Feed raw bytes from the child PTY into libvterm.