RADLib
RADical C++ application framework
RADUi::PtyTerminalSession Class Reference

PTY-backed terminal session that feeds output into TerminalBuffer. More...

#include <RADTerminal.h>

Public Member Functions

 PtyTerminalSession (std::function< void()> changed={})
 Creates a terminal session and optional change callback. More...
 
 ~PtyTerminalSession ()
 Stops the session and joins the reader thread. More...
 
 PtyTerminalSession (const PtyTerminalSession &)=delete
 Terminal sessions own a PTY and are not copied. More...
 
PtyTerminalSessionoperator= (const PtyTerminalSession &)=delete
 Terminal sessions own a PTY and are not copied. More...
 
bool start (const std::string &shell={}, uint16_t rows=30, uint16_t columns=120)
 Starts shell in a PTY sized rows by columns. More...
 
void stop ()
 Stops the child process and reader thread. More...
 
bool isRunning () const
 Returns true while the PTY session is active. More...
 
bool resize (uint16_t rows, uint16_t columns)
 Resizes the PTY and terminal buffer. More...
 
bool isAlternateScreen () const
 Returns true when the terminal is using its alternate screen. More...
 
TerminalCursor cursor () const
 Returns current terminal cursor state. More...
 
void writeInput (std::string_view input)
 Writes user input bytes to the PTY. More...
 
std::vector< TerminalLinesnapshot () const
 Returns a copy of visible terminal lines. More...
 
std::string plainText () const
 Returns visible terminal text without color metadata. More...
 

Detailed Description

PTY-backed terminal session that feeds output into TerminalBuffer.

Constructor & Destructor Documentation

◆ PtyTerminalSession() [1/2]

RADUi::PtyTerminalSession::PtyTerminalSession ( std::function< void()>  changed = {})
explicit

Creates a terminal session and optional change callback.

◆ ~PtyTerminalSession()

RADUi::PtyTerminalSession::~PtyTerminalSession ( )

Stops the session and joins the reader thread.

◆ PtyTerminalSession() [2/2]

RADUi::PtyTerminalSession::PtyTerminalSession ( const PtyTerminalSession )
delete

Terminal sessions own a PTY and are not copied.

Member Function Documentation

◆ cursor()

TerminalCursor RADUi::PtyTerminalSession::cursor ( ) const

Returns current terminal cursor state.

◆ isAlternateScreen()

bool RADUi::PtyTerminalSession::isAlternateScreen ( ) const

Returns true when the terminal is using its alternate screen.

◆ isRunning()

bool RADUi::PtyTerminalSession::isRunning ( ) const

Returns true while the PTY session is active.

◆ operator=()

PtyTerminalSession& RADUi::PtyTerminalSession::operator= ( const PtyTerminalSession )
delete

Terminal sessions own a PTY and are not copied.

◆ plainText()

std::string RADUi::PtyTerminalSession::plainText ( ) const

Returns visible terminal text without color metadata.

◆ resize()

bool RADUi::PtyTerminalSession::resize ( uint16_t  rows,
uint16_t  columns 
)

Resizes the PTY and terminal buffer.

◆ snapshot()

std::vector<TerminalLine> RADUi::PtyTerminalSession::snapshot ( ) const

Returns a copy of visible terminal lines.

◆ start()

bool RADUi::PtyTerminalSession::start ( const std::string &  shell = {},
uint16_t  rows = 30,
uint16_t  columns = 120 
)

Starts shell in a PTY sized rows by columns.

◆ stop()

void RADUi::PtyTerminalSession::stop ( )

Stops the child process and reader thread.

◆ writeInput()

void RADUi::PtyTerminalSession::writeInput ( std::string_view  input)

Writes user input bytes to the PTY.


The documentation for this class was generated from the following file: