Guide API
Skip to main content

Module terminal

Module terminal 

Source
Expand description

A scrolling text terminal: TextDevice (the output trait) and Terminal (a ring-buffer view that shows the most recent lines).

Terminal embeds a Scroller and delegates the un-overridden View methods to it; the ring buffer stores raw bytes and the draw decodes them UTF-8-width-aware. Users write to it through write_bytes; there is no stream wrapper.

§Construction

Building a terminal does not set its scroll limit, cursor, or visibility, because those need a Context not available at construction. The consumer calls Terminal::init once after inserting the terminal into a group (the same pattern as the outline viewer).

§Turbo Vision heritage

Ports TTextDevice (textview.cpp) and TTerminal (ttprvlns.cpp). Inheritance becomes a trait plus an embed-and-delegate wrapper over Scroller (deviation D2); the C++ stream plumbing is replaced by the direct write_bytes call (deviations D11, D12); the color map becomes a Role; and the byte buffer is decoded with UTF-8-aware width (deviation D13).

Structs§

Terminal
A ring-buffer terminal view. Stores incoming text in a fixed-size ring buffer and draws the most-recent size.y lines.

Traits§

TextDevice
The abstract text-output device. Users of the terminal call write_bytes directly.