pub trait Screen {
type C: Cell;
// Required methods
fn cell(&self, row: u16, col: u16) -> Option<&Self::C>;
fn hide_cursor(&self) -> bool;
fn cursor_position(&self) -> (u16, u16);
// Provided method
fn cursor_shape(&self) -> CursorShape { ... }
}Expand description
A trait representing a pseudo-terminal screen.
Implementing this trait allows for backends other than vt100 to be used
with the PseudoTerminal widget.
All row coordinates use a visible coordinate system where row 0 is the
topmost row currently displayed. When scrollback is active, this may
differ from the underlying terminal buffer’s row numbering. Implementors
must ensure that cell and cursor_position
use the same coordinate space.
Required Associated Types§
Required Methods§
Sourcefn cell(&self, row: u16, col: u16) -> Option<&Self::C>
fn cell(&self, row: u16, col: u16) -> Option<&Self::C>
Returns the cell at the given location in visible coordinates.
Row 0 is the topmost visible row, accounting for any scrollback offset.
Sourcefn hide_cursor(&self) -> bool
fn hide_cursor(&self) -> bool
Returns whether the cursor should be hidden.
Sourcefn cursor_position(&self) -> (u16, u16)
fn cursor_position(&self) -> (u16, u16)
Returns the cursor position in visible coordinates.
The return value is (row, column), where row 0 is the topmost visible
row. This must use the same coordinate space as cell.
When scrollback is active, the cursor row must be shifted down by the
number of scrollback rows visible above the active screen content.
If the cursor is not within the visible area (e.g., scrolled off-screen), the returned row may exceed the screen dimensions. The rendering layer handles bounds checking.
Provided Methods§
Sourcefn cursor_shape(&self) -> CursorShape
fn cursor_shape(&self) -> CursorShape
Returns the preferred shape of the cursor.
The default implementation returns CursorShape::Default, which
preserves the widget’s configured cursor symbol. Backends that can
report the terminal’s preferred cursor shape should override this.