|
|
| TerminalSession (const TerminalSession &)=delete |
| | Exclusive state cannot be copied.
|
|
TerminalSession & | operator= (const TerminalSession &)=delete |
| | Exclusive state cannot be copied.
|
| | TerminalSession (TerminalSession &&other) noexcept |
| | Transfer ownership; source becomes closed.
|
| TerminalSession & | operator= (TerminalSession &&other) noexcept |
| | Best-effort close old state, then transfer.
|
|
| ~TerminalSession () noexcept |
| | Best-effort restoration and descriptor cleanup; never flushes.
|
| TerminalRead | read (TerminalDeadline deadline, std::stop_token stop={}) |
| | Read one bounded owning batch, changed size, deadline, stop, EOF or error. Stop takes precedence over an expired deadline. Resize is sampled on the owner, at most wait_cadence apart while waiting; changes can coalesce. No callbacks. Windows returns events only, using windows_input for VT/paste decoding. An empty progress batch yields after the native record work budget. Paste is emitted at its end delimiter; interleaved native events may precede that completed event.
|
| std::expected< CellSize, TerminalError > | size () const noexcept |
| | Query current columns/rows; returns closed/system error without mutation.
|
| std::expected< void, TerminalError > | submit (std::string bytes) |
| | Transfer one bounded owned byte batch; reject while output is pending. No I/O. Empty batch is allowed. Rejection leaves session state unchanged.
|
| TerminalWrite | flush (TerminalDeadline deadline, std::stop_token stop={}) |
| | Write until batch completion, deadline, stop or error; retain unconfirmed bytes. Only successful native writes count as completed. Deadline/stop are checked between nonblocking syscalls on POSIX, preserving its retryable suffix. Windows uses one owning worker. Cancelling an issued write returns deadline or stopped with error=OUTPUT_UNCERTAIN; bytes remain owned, but cannot be retried. Further submit/flush fail until close. A pre-expired/pre-stopped call that has issued no write preserves retryability and has no uncertainty error. Successful writes do not prove terminal interpretation or rendered-frame state.
|
| std::size_t | pendingBytes () const noexcept |
| | Number of pending owned bytes; zero for a closed/moved-from session.
|
| std::expected< void, TerminalError > | close () noexcept |
| | Discard pending bytes and restore all changed modes/flags independently. Always closes owned duplicate descriptors, even on restoration error. Returns first native restoration/close error. Idempotent; destructor cannot report errors. Windows first requests cancellation until the worker actually completes, joins, then restores modes/code page. Console-host progress is required: restoration can wait for a paused host to resume output drain. No hard deadline is promised for close/destruction or arbitrary stalled drivers/hosts; nothing is detached. Incomplete/failed output leaves renderer belief uncertain, owned by the caller.
|
Move-only terminal mode and I/O owner; no I/O belongs in paint/measure.
One executor owns all calls including destruction; concurrent calls are unsupported. Transfer between executors requires external synchronization. POSIX and Windows open duplicate both native handles and own the duplicates; caller handles stay open. All aliases of their terminals/open-file descriptions must be exclusively used by this owner until close, because termios and file status flags are shared. Windows console modes and output code page are console-wide, including all aliases. Input/output values own storage. Allocation exceptions propagate with RAII cleanup; no caller buffer/view is retained. This backend installs no signal handlers. No guarantee is made for abrupt process death or externally closed/modified handles.
Read one bounded owning batch, changed size, deadline, stop, EOF or error. Stop takes precedence over an expired deadline. Resize is sampled on the owner, at most wait_cadence apart while waiting; changes can coalesce. No callbacks. Windows returns events only, using windows_input for VT/paste decoding. An empty progress batch yields after the native record work budget. Paste is emitted at its end delimiter; interleaved native events may precede that completed event.
- Parameters
-
| deadline | Absolute steady-clock deadline bounding this read operation. |
| stop | Cooperative cancellation request, checked before the deadline. |
- Returns
- An owning input/resize batch, or deadline, stopped, eof or an explicit terminal error.
- Exceptions
-
| std::bad_alloc | If owning batch storage cannot be allocated. |