pub struct Screen { /* private fields */ }Expand description
One pane screen, including scrollback, alternate-screen state, cursor position, modes, tab stops, and hyperlink storage.
Implementations§
Source§impl Screen
impl Screen
Sourcepub fn recovery_row_renderer(
&self,
max_hyperlink_entry_bytes: usize,
max_hyperlink_total_bytes: usize,
) -> RecoveryRowRenderer<'_>
pub fn recovery_row_renderer( &self, max_hyperlink_entry_bytes: usize, max_hyperlink_total_bytes: usize, ) -> RecoveryRowRenderer<'_>
Creates a recovery renderer with bounded terminal-controlled metadata.
Sourcepub fn capture_transcript(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Vec<u8> ⓘ
pub fn capture_transcript( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Vec<u8> ⓘ
Captures a tmux-style line range over the current grid contents.
Sourcepub fn capture_line_format_flags(&self, range: ScreenCaptureRange) -> Vec<u8> ⓘ
pub fn capture_line_format_flags(&self, range: ScreenCaptureRange) -> Vec<u8> ⓘ
Captures tmux-style per-line format flags for the selected physical rows.
Sourcepub fn capture_transcript_lines_independent(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Vec<Vec<u8>>
pub fn capture_transcript_lines_independent( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Vec<Vec<u8>>
Captures physical lines with each line rendered from a fresh ANSI state.
This is intended for renderers that repaint individual terminal rows: a row must carry its own SGR state instead of depending on a previous captured row having been emitted first.
Sourcepub fn capture_transcript_rows_independent(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Vec<(Vec<u8>, bool)>
pub fn capture_transcript_rows_independent( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Vec<(Vec<u8>, bool)>
Captures physical rows from fresh ANSI states together with each row’s soft-wrap flag.
Recovery renderers use the flag to preserve scrollback reflow: a wrapped row is followed immediately by the next row, while a hard line break is represented by CRLF.
Sourcepub fn visible_line_revision(&self, row: usize) -> Option<u64>
pub fn visible_line_revision(&self, row: usize) -> Option<u64>
Returns the monotonic mutation revision for one visible row.
Sourcepub fn render_visible_line_independent(
&self,
row: usize,
options: GridRenderOptions,
) -> Option<Vec<u8>>
pub fn render_visible_line_independent( &self, row: usize, options: GridRenderOptions, ) -> Option<Vec<u8>>
Renders one visible row from a fresh ANSI state.
Sourcepub fn render_visible_line_independent_with_default_style(
&self,
row: usize,
options: GridRenderOptions,
style: &Style,
) -> Option<Vec<u8>>
pub fn render_visible_line_independent_with_default_style( &self, row: usize, options: GridRenderOptions, style: &Style, ) -> Option<Vec<u8>>
Renders one visible row from a fresh ANSI state after applying pane default-style to default cells only.
Sourcepub fn capture_saved_transcript(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Option<Vec<u8>>
pub fn capture_saved_transcript( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Option<Vec<u8>>
Captures the saved pre-alternate-screen copy when alternate mode is active.
Sourcepub fn capture_saved_transcript_lines_independent(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Option<Vec<Vec<u8>>>
pub fn capture_saved_transcript_lines_independent( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Option<Vec<Vec<u8>>>
Captures saved pre-alternate-screen rows from independent ANSI states.
Sourcepub fn capture_saved_transcript_rows_independent(
&self,
range: ScreenCaptureRange,
options: GridRenderOptions,
) -> Option<Vec<(Vec<u8>, bool)>>
pub fn capture_saved_transcript_rows_independent( &self, range: ScreenCaptureRange, options: GridRenderOptions, ) -> Option<Vec<(Vec<u8>, bool)>>
Captures saved pre-alternate-screen rows and their soft-wrap flags.
Sourcepub fn capture_saved_recovery_rows_independent(
&self,
options: GridRenderOptions,
) -> Option<Vec<(Vec<u8>, bool)>>
pub fn capture_saved_recovery_rows_independent( &self, options: GridRenderOptions, ) -> Option<Vec<(Vec<u8>, bool)>>
Captures the complete saved main screen while alternate mode is active.
The live grid retains main-screen history while the saved grid retains its visible rows, so recovery must join those two stores explicitly.
Sourcepub fn capture_saved_line_format_flags(
&self,
range: ScreenCaptureRange,
) -> Option<Vec<u8>>
pub fn capture_saved_line_format_flags( &self, range: ScreenCaptureRange, ) -> Option<Vec<u8>>
Captures tmux-style per-line format flags from the saved alternate screen.
Source§impl Screen
impl Screen
Sourcepub fn tmux_history_bytes(&self) -> usize
pub fn tmux_history_bytes(&self) -> usize
Returns tmux-compatible grid allocation bytes for #{history_bytes}.
Sourcepub fn tmux_history_all_bytes(&self) -> String
pub fn tmux_history_all_bytes(&self) -> String
Returns tmux-compatible grid allocation counters for #{history_all_bytes}.
Source§impl Screen
impl Screen
Sourcepub fn has_selected_cells(&self) -> bool
pub fn has_selected_cells(&self) -> bool
Returns whether any visible cell is currently marked as selected.
Sourcepub fn mark_selected_row_range(&mut self, row: u32, start_x: u32, end_x: u32)
pub fn mark_selected_row_range(&mut self, row: u32, start_x: u32, end_x: u32)
Marks one visible row range as selected.
Sourcepub fn clear_selected_cells(&mut self)
pub fn clear_selected_cells(&mut self)
Clears all visible selected-cell markers.
Sourcepub fn overlay_style_on_selected(&mut self, style_input: &str)
pub fn overlay_style_on_selected(&mut self, style_input: &str)
Overlays style_input onto all selected visible cells.
Source§impl Screen
impl Screen
Sourcepub fn overlay_style_on_default_cells(&mut self, style_input: &str)
pub fn overlay_style_on_default_cells(&mut self, style_input: &str)
Applies style_input only where the application left cell styling unset.
Sourcepub fn overlay_default_style(&mut self, style: &Style)
pub fn overlay_default_style(&mut self, style: &Style)
Applies style only where the application left cell styling unset.
Source§impl Screen
impl Screen
Sourcepub fn recovery_metadata_fits(
&self,
max_string_bytes: usize,
max_title_stack_bytes: usize,
max_hyperlink_entry_bytes: usize,
max_hyperlink_total_bytes: usize,
) -> bool
pub fn recovery_metadata_fits( &self, max_string_bytes: usize, max_title_stack_bytes: usize, max_hyperlink_entry_bytes: usize, max_hyperlink_total_bytes: usize, ) -> bool
Reports whether recovery metadata fits the supplied bounds without cloning viewport or scrollback rows.
Sourcepub fn clone_recovery_viewport_bounded(
&self,
max_string_bytes: usize,
max_title_stack_bytes: usize,
max_hyperlink_entry_bytes: usize,
max_hyperlink_total_bytes: usize,
) -> (Self, bool)
pub fn clone_recovery_viewport_bounded( &self, max_string_bytes: usize, max_title_stack_bytes: usize, max_hyperlink_entry_bytes: usize, max_hyperlink_total_bytes: usize, ) -> (Self, bool)
Clones only the visible viewport and bounded terminal metadata.
Recovery callers validate geometry before invoking this method. Unlike
Screen::clone, this path never copies scrollback, saved alternate
grids, passthrough payloads, or unbounded title/link strings.
Sourcepub fn clone_recovery_projection_bounded(
&self,
max_string_bytes: usize,
max_title_stack_bytes: usize,
max_hyperlink_entry_bytes: usize,
max_hyperlink_total_bytes: usize,
max_history_bytes: usize,
) -> (Self, bool)
pub fn clone_recovery_projection_bounded( &self, max_string_bytes: usize, max_title_stack_bytes: usize, max_hyperlink_entry_bytes: usize, max_hyperlink_total_bytes: usize, max_history_bytes: usize, ) -> (Self, bool)
Clones a transport-bounded recovery projection without rendering it.
The active viewport and saved alternate viewport are retained. Scrollback
is limited to the newest complete logical-line suffix whose structural
clone fits max_history_bytes.
Sourcepub fn clone_recovery_viewport_at_bounded(
&self,
top_line: usize,
cursor_x: u32,
cursor_absolute_y: usize,
max_string_bytes: usize,
max_title_stack_bytes: usize,
max_hyperlink_entry_bytes: usize,
max_hyperlink_total_bytes: usize,
) -> (Self, bool)
pub fn clone_recovery_viewport_at_bounded( &self, top_line: usize, cursor_x: u32, cursor_absolute_y: usize, max_string_bytes: usize, max_title_stack_bytes: usize, max_hyperlink_entry_bytes: usize, max_hyperlink_total_bytes: usize, ) -> (Self, bool)
Clones a bounded viewport over absolute rows for Web scroll/copy-mode recovery without first cloning the backing history.
Sourcepub fn visit_visible_line_cells(
&self,
row: usize,
cols: usize,
visit: impl FnMut(ScreenCellRef<'_>),
) -> bool
pub fn visit_visible_line_cells( &self, row: usize, cols: usize, visit: impl FnMut(ScreenCellRef<'_>), ) -> bool
Visits borrowed cells for one visible row, padding to cols cells.
Returns false when row is outside the visible viewport. Plain ASCII
compact rows are visited directly from their compact text storage, so
callers that only need the visible viewport can avoid the owned
ScreenLineView allocation path.
Sourcepub fn absolute_line_view(&self, absolute_y: usize) -> Option<ScreenLineView>
pub fn absolute_line_view(&self, absolute_y: usize) -> Option<ScreenLineView>
Returns a read-only copy of one absolute line.
Sourcepub fn clone_viewport(
&self,
top_line: usize,
cursor_x: u32,
cursor_absolute_y: usize,
) -> Self
pub fn clone_viewport( &self, top_line: usize, cursor_x: u32, cursor_absolute_y: usize, ) -> Self
Clones the screen as a standalone viewport over its absolute lines.
Source§impl Screen
impl Screen
Sourcepub fn new(size: TerminalSize, history_limit: usize) -> Self
pub fn new(size: TerminalSize, history_limit: usize) -> Self
Creates a new screen with the given geometry and history limit.
Sourcepub const fn cursor_style(&self) -> u32
pub const fn cursor_style(&self) -> u32
Returns the most recent DECSCUSR cursor style parameter.
Sourcepub const fn scroll_region(&self) -> (u32, u32)
pub const fn scroll_region(&self) -> (u32, u32)
Returns the DECSTBM scroll region as (top, bottom) rows, 0-based and
inclusive. A full-screen region is (0, rows - 1).
Sourcepub fn size(&self) -> TerminalSize
pub fn size(&self) -> TerminalSize
Returns the screen size.
Sourcepub fn title_stack(&self) -> &[String]
pub fn title_stack(&self) -> &[String]
Returns the title stack from oldest to newest.
Sourcepub const fn title_stack_limit() -> usize
pub const fn title_stack_limit() -> usize
Maximum title stack depth accepted by the terminal model.
Sourcepub const fn metadata_revision(&self) -> u64
pub const fn metadata_revision(&self) -> u64
Returns the revision of terminal-controlled metadata.
Sourcepub fn set_title_rename_enabled(&mut self, enabled: bool)
pub fn set_title_rename_enabled(&mut self, enabled: bool)
Enables or disables title changes requested by pane output.
Sourcepub fn set_alternate_screen_enabled(&mut self, enabled: bool)
pub fn set_alternate_screen_enabled(&mut self, enabled: bool)
Enables or disables DEC alternate-screen entry for this screen.
Exit sequences are still honored by the writer so disabling the option while a pane is already in alternate screen does not trap it there.
Sourcepub fn is_alternate(&self) -> bool
pub fn is_alternate(&self) -> bool
Returns whether the alternate screen is active.
Sourcepub fn alternate_saved_cursor(&self) -> Option<(u32, u32, bool)>
pub fn alternate_saved_cursor(&self) -> Option<(u32, u32, bool)>
Returns the cursor saved by DEC alternate-screen entry, when present.
Sourcepub const fn pending_wrap(&self) -> bool
pub const fn pending_wrap(&self) -> bool
Returns whether the next printable character first performs autowrap.
Sourcepub fn history_limit(&self) -> usize
pub fn history_limit(&self) -> usize
Returns the configured history limit.
Sourcepub fn history_size(&self) -> usize
pub fn history_size(&self) -> usize
Returns the current history size in rows.
Sourcepub const fn cursor_position(&self) -> (u32, u32)
pub const fn cursor_position(&self) -> (u32, u32)
Returns the current cursor position within the visible viewport.
Sourcepub fn cursor_absolute_y(&self) -> usize
pub fn cursor_absolute_y(&self) -> usize
Returns the absolute cursor row including history.
Sourcepub fn absolute_line_count(&self) -> usize
pub fn absolute_line_count(&self) -> usize
Returns the total number of absolute lines retained by the screen.
Sourcepub fn delete_visible_line(&mut self, y: u32) -> bool
pub fn delete_visible_line(&mut self, y: u32) -> bool
Deletes one visible line and scrolls the remaining viewport content up.
This clears any pending wrap state because deleting a visible row invalidates the previous cursor edge condition.
Sourcepub fn delete_absolute_line(&mut self, absolute_y: usize) -> bool
pub fn delete_absolute_line(&mut self, absolute_y: usize) -> bool
Deletes one absolute line from history or the visible viewport.
Sourcepub fn trim_below_cursor(&mut self) -> bool
pub fn trim_below_cursor(&mut self) -> bool
Trims all lines below the cursor and pulls history into the viewport.
Sourcepub fn history_bytes(&self) -> usize
pub fn history_bytes(&self) -> usize
Returns the current retained history size in bytes.
Sourcepub fn take_bell_count(&mut self) -> u64
pub fn take_bell_count(&mut self) -> u64
Drains and returns the number of BEL notifications observed since the last drain.
Sourcepub fn take_terminal_passthrough(&mut self) -> Vec<TerminalPassthrough>
pub fn take_terminal_passthrough(&mut self) -> Vec<TerminalPassthrough>
Drains terminal passthrough events observed since the last drain.
Sourcepub fn take_terminal_passthrough_dropped_count(&mut self) -> u64
pub fn take_terminal_passthrough_dropped_count(&mut self) -> u64
Drains the count of terminal passthrough events dropped by safety limits.
Sourcepub fn hyperlink_uri(&self, inner_id: u32) -> Option<&str>
pub fn hyperlink_uri(&self, inner_id: u32) -> Option<&str>
Returns the stored OSC 8 URI for a hyperlink inner ID.
Sourcepub fn set_history_limit(&mut self, limit: usize)
pub fn set_history_limit(&mut self, limit: usize)
Updates the history limit.
Sourcepub fn set_utf8_config(&mut self, utf8_config: Utf8Config)
pub fn set_utf8_config(&mut self, utf8_config: Utf8Config)
Updates the tmux-style UTF-8 width and combining configuration.
Sourcepub fn resize(&mut self, size: TerminalSize)
pub fn resize(&mut self, size: TerminalSize)
Resizes the screen and resets the scroll region.
Sourcepub fn clear_history_and_hyperlinks(&mut self, reset_hyperlinks: bool)
pub fn clear_history_and_hyperlinks(&mut self, reset_hyperlinks: bool)
Clears history and optionally resets stored hyperlinks.
Trait Implementations§
impl Eq for Screen
Source§impl ScreenWriter for Screen
impl ScreenWriter for Screen
Source§fn collect_add(&mut self, ch: char, cell: &CellState)
fn collect_add(&mut self, ch: char, cell: &CellState)
Source§fn collect_add_with_charset(&mut self, ch: char, cell: &CellState, acs: bool)
fn collect_add_with_charset(&mut self, ch: char, cell: &CellState, acs: bool)
acs is true.Source§fn collect_add_ascii_run(&mut self, bytes: &[u8], cell: &CellState, acs: bool)
fn collect_add_ascii_run(&mut self, bytes: &[u8], cell: &CellState, acs: bool)
Source§fn cursor_down(&mut self, n: u32)
fn cursor_down(&mut self, n: u32)
n rows.Source§fn cursor_left(&mut self, n: u32)
fn cursor_left(&mut self, n: u32)
n columns.Source§fn cursor_right(&mut self, n: u32)
fn cursor_right(&mut self, n: u32)
n columns.Source§fn cursor_move(&mut self, col: i32, row: i32, origin_mode: bool)
fn cursor_move(&mut self, col: i32, row: i32, origin_mode: bool)
Source§fn insert_line(&mut self, n: u32, bg: i32)
fn insert_line(&mut self, n: u32, bg: i32)
n blank lines at cursor, scrolling down.Source§fn delete_line(&mut self, n: u32, bg: i32)
fn delete_line(&mut self, n: u32, bg: i32)
n lines at cursor, scrolling up.Source§fn scroll_down(&mut self, n: u32, bg: i32)
fn scroll_down(&mut self, n: u32, bg: i32)
n lines.Source§fn reverse_index(&mut self, bg: i32)
fn reverse_index(&mut self, bg: i32)
Source§fn carriage_return(&mut self)
fn carriage_return(&mut self)
Source§fn insert_character(&mut self, n: u32, bg: i32)
fn insert_character(&mut self, n: u32, bg: i32)
n blank characters at cursor.Source§fn delete_character(&mut self, n: u32, bg: i32)
fn delete_character(&mut self, n: u32, bg: i32)
n characters at cursor.Source§fn clear_character(&mut self, n: u32, bg: i32)
fn clear_character(&mut self, n: u32, bg: i32)
n characters at cursor.Source§fn clear_end_of_screen(&mut self, bg: i32)
fn clear_end_of_screen(&mut self, bg: i32)
Source§fn clear_start_of_screen(&mut self, bg: i32)
fn clear_start_of_screen(&mut self, bg: i32)
Source§fn clear_screen(&mut self, _bg: i32)
fn clear_screen(&mut self, _bg: i32)
Source§fn clear_history(&mut self)
fn clear_history(&mut self)
Source§fn clear_end_of_line(&mut self, bg: i32)
fn clear_end_of_line(&mut self, bg: i32)
Source§fn clear_start_of_line(&mut self, bg: i32)
fn clear_start_of_line(&mut self, bg: i32)
Source§fn clear_line(&mut self, bg: i32)
fn clear_line(&mut self, bg: i32)
Source§fn mode_clear(&mut self, mode_bits: u32)
fn mode_clear(&mut self, mode_bits: u32)
Source§fn set_scroll_region(&mut self, top: u32, bottom: u32)
fn set_scroll_region(&mut self, top: u32, bottom: u32)
Source§fn alternate_on(&mut self, bg: i32, save_cursor: bool)
fn alternate_on(&mut self, bg: i32, save_cursor: bool)
save_cursor = true for 1049.Source§fn alternate_off(&mut self, _bg: i32, restore_cursor: bool)
fn alternate_off(&mut self, _bg: i32, restore_cursor: bool)
Source§fn cursor_backward_tab(&mut self, n: u32)
fn cursor_backward_tab(&mut self, n: u32)
n tab stops (CBT).Source§fn set_tab_stop(&mut self)
fn set_tab_stop(&mut self)
Source§fn clear_tab_stop(&mut self)
fn clear_tab_stop(&mut self)
Source§fn clear_all_tab_stops(&mut self)
fn clear_all_tab_stops(&mut self)
Source§fn set_window_name(&mut self, name: &str)
fn set_window_name(&mut self, name: &str)
Source§fn save_cursor(&mut self)
fn save_cursor(&mut self)
Source§fn restore_cursor(&mut self)
fn restore_cursor(&mut self)
Source§fn alignment_test(&mut self)
fn alignment_test(&mut self)
Source§fn full_reset(&mut self)
fn full_reset(&mut self)
Source§fn start_sync(&mut self)
fn start_sync(&mut self)
Source§fn set_cursor_style(&mut self, n: u32)
fn set_cursor_style(&mut self, n: u32)
n is the Ps value 0-6.