[][src]Struct glint::term_buffer::TermBuffer

pub struct TermBuffer { /* fields omitted */ }

Represents a range of lines in a terminal and the cursor position. This is suitable when you don't want to use an "alternate screen", but rather retain previous terminal output, such as shell prompts/responses.

New frames are rendered by replacing the lines. All operations work on a relative coordinate system where (0, 0) is the top-left corner of the lines TermBuffer controls.

Further, we never check the actual cursor position, but rather move the cursor relative to its current position. The meaning of (0, 0) is actually the cursor position when TermBuffer first renders.

Methods

impl TermBuffer[src]

pub fn new() -> Self[src]

pub fn push_line(&mut self, row: impl Into<String>)[src]

Add a row to the desired output

pub fn lines(&self) -> u16[src]

pub fn set_next_cursor(&mut self, cursor: (u16, u16))[src]

Positions the cursor where (0, 0) is the first character printed by this program

pub fn forget(&mut self)[src]

This causes us to skip past the currently displayed buffer area and forget about it, resulting in future renders to happen below it. If this is called, and then the TermBuffer is dropped, the default behavior of clearing the area will be a no-op.

pub fn render_frame(&mut self)[src]

Renders a complete frame to the terminal

pub fn flush(&mut self)[src]

Trait Implementations

impl Drop for TermBuffer[src]

impl Default for TermBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]