pub struct StreamView { /* private fields */ }Expand description
A scrollback of styled lines, with autoscroll that releases when the user scrolls back and re-arms at the bottom.
Implementations§
Source§impl StreamView
impl StreamView
pub fn new(bounds: Rect) -> Self
pub fn set_max_lines(&mut self, n: usize)
Sourcepub fn set_partial(&mut self, cells: &[Cell])
pub fn set_partial(&mut self, cells: &[Cell])
Replaces the in-progress line. Called on every repaint while a line is still streaming, so it must overwrite rather than append.
pub fn clear(&mut self)
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Total displayed lines, including the in-progress one.
Sourcepub fn row_count(&self) -> usize
pub fn row_count(&self) -> usize
Total display rows currently shown, including the in-progress line’s
wrapped rows. This is what scroll arithmetic (page, max_top, and
the keyboard handlers) counts, so scrolling lands correctly wherever
a wrapped long line pushes rows out of alignment with logical lines.
pub fn scroll_to_bottom(&mut self)
pub fn scroll_to_top(&mut self)
pub fn scroll_up(&mut self, n: usize)
pub fn scroll_down(&mut self, n: usize)
pub fn is_at_bottom(&self) -> bool
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Selects the entire scrollback in stream mode. Leaves no selection if the buffer is empty.
Sourcepub fn set_selection(&mut self, anchor: (usize, usize), head: (usize, usize))
pub fn set_selection(&mut self, anchor: (usize, usize), head: (usize, usize))
Sets a selection between two carets (row, col). Order-independent:
anchor and head may be given in either order.
pub fn clear_selection(&mut self)
pub fn has_selection(&self) -> bool
Sourcepub fn selected_text(&self) -> Option<String>
pub fn selected_text(&self) -> Option<String>
The selected text, or None when there is no selection. Logical lines
are reconstructed: a soft wrap within a line does not become a newline.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
The whole scrollback with attributes stripped, for File > Save As.
Sourcepub fn styled_lines(&self) -> Vec<Vec<Cell>>
pub fn styled_lines(&self) -> Vec<Vec<Cell>>
The whole scrollback with attributes intact, for tests and golden files.
Trait Implementations§
Source§impl Debug for StreamView
impl Debug for StreamView
Source§impl View for StreamView
impl View for StreamView
fn bounds(&self) -> Rect
fn set_bounds(&mut self, bounds: Rect)
fn draw(&mut self, terminal: &mut Terminal)
fn handle_event(&mut self, event: &mut Event)
Source§fn grow_mode(&self) -> GrowFlags
fn grow_mode(&self) -> GrowFlags
Source§fn set_grow_mode(&mut self, grow_mode: GrowFlags)
fn set_grow_mode(&mut self, grow_mode: GrowFlags)
fn can_focus(&self) -> bool
Source§fn get_palette(&self) -> Option<Palette>
fn get_palette(&self) -> Option<Palette>
Source§fn set_focus(&mut self, focused: bool)
fn set_focus(&mut self, focused: bool)
Source§fn window_number(&self) -> Option<u8>
fn window_number(&self) -> Option<u8>
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn options(&self) -> u16
fn options(&self) -> u16
Source§fn set_options(&mut self, _options: u16)
fn set_options(&mut self, _options: u16)
Source§fn set_state_flag(&mut self, flag: u16, enable: bool)
fn set_state_flag(&mut self, flag: u16, enable: bool)
Source§fn get_state_flag(&self, flag: u16) -> bool
fn get_state_flag(&self, flag: u16) -> bool
Source§fn has_shadow(&self) -> bool
fn has_shadow(&self) -> bool
Source§fn shadow_bounds(&self) -> Rect
fn shadow_bounds(&self) -> Rect
Source§fn update_cursor(&self, _terminal: &mut Terminal)
fn update_cursor(&self, _terminal: &mut Terminal)
Source§fn zoom(&mut self, _max_bounds: Rect)
fn zoom(&mut self, _max_bounds: Rect)
Source§fn valid(&mut self, _command: u16) -> bool
fn valid(&mut self, _command: u16) -> bool
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Source§fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<(), Error>
fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<(), Error>
Source§fn set_list_selection(&mut self, _index: usize)
fn set_list_selection(&mut self, _index: usize)
Source§fn get_list_selection(&self) -> usize
fn get_list_selection(&self) -> usize
Source§fn get_redraw_union(&self) -> Option<Rect>
fn get_redraw_union(&self) -> Option<Rect>
Source§fn clear_move_tracking(&mut self)
fn clear_move_tracking(&mut self)
Source§fn get_end_state(&self) -> u16
fn get_end_state(&self) -> u16
Source§fn set_end_state(&mut self, _command: u16)
fn set_end_state(&mut self, _command: u16)
Source§fn make_global(&self, local_x: i16, local_y: i16) -> (i16, i16)
fn make_global(&self, local_x: i16, local_y: i16) -> (i16, i16)
Source§fn make_local(&self, global_x: i16, global_y: i16) -> (i16, i16)
fn make_local(&self, global_x: i16, global_y: i16) -> (i16, i16)
Source§fn draw_shadow(&self, terminal: &mut Terminal)
fn draw_shadow(&self, terminal: &mut Terminal)
Source§fn label_link(&self) -> Option<ViewId>
fn label_link(&self) -> Option<ViewId>
Source§fn init_after_add(&mut self)
fn init_after_add(&mut self)
Source§fn constrain_to_parent_bounds(&mut self)
fn constrain_to_parent_bounds(&mut self)
Source§fn set_palette_chain(&mut self, _node: Option<PaletteChainNode>)
fn set_palette_chain(&mut self, _node: Option<PaletteChainNode>)
Source§fn get_palette_chain(&self) -> Option<&PaletteChainNode>
fn get_palette_chain(&self) -> Option<&PaletteChainNode>
map_color() to safely walk the owner chain.