pub struct Control { /* private fields */ }Expand description
A renderable that inserts terminal control codes.
Mirrors rich.control.Control. Construct it via the factory methods
(Control::clear, [Control::move], …) or Control::new with an
explicit list of codes, which are concatenated in order.
Implementations§
Source§impl Control
impl Control
Sourcepub fn new(codes: &[ControlType]) -> Self
pub fn new(codes: &[ControlType]) -> Self
Build a control from a sequence of codes, rendered end to end.
Sourcepub fn move_(x: i32, y: i32) -> Self
pub fn move_(x: i32, y: i32) -> Self
Move the cursor relative to its current position (x columns, y rows;
positive is right/down). Port of Control.move.
Sourcepub fn move_to_column(x: u32, y: i32) -> Self
pub fn move_to_column(x: u32, y: i32) -> Self
Move to a zero-based column, optionally offset the row by y. Port of
Control.move_to_column.
Sourcepub fn move_to(x: u32, y: u32) -> Self
pub fn move_to(x: u32, y: u32) -> Self
Move the cursor to an absolute zero-based (x, y) position.
Sourcepub fn show_cursor(show: bool) -> Self
pub fn show_cursor(show: bool) -> Self
Show or hide the cursor.
Sourcepub fn alt_screen(enable: bool) -> Self
pub fn alt_screen(enable: bool) -> Self
Enable or disable the terminal’s alternate screen buffer. Port of
Control.alt_screen: enabling also moves the cursor home.
Trait Implementations§
Source§impl Renderable for Control
impl Renderable for Control
Source§fn print_end_line(&self, _options: &ConsoleOptions) -> bool
fn print_end_line(&self, _options: &ConsoleOptions) -> bool
Upstream’s Control yields its one segment and no line break, so a
printed control (as a live display’s render hook prints one) leaves
the line open.
fn rich_render( &self, _console: &Console, _options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn measure(&self, _console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, _console: &Console, options: &ConsoleOptions) -> Measurement
(minimum, maximum) cell width this renderable wants. Port of
__rich_measure__. The default is what upstream’s Measurement.get
returns for a renderable without one: anything from nothing to the
whole width, (0, max_width).Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.