pub struct TerminalDamage {
pub full: bool,
pub dirty_lines: Vec<usize>,
pub cursor_dirty: bool,
pub title_dirty: bool,
}Expand description
Accumulated terminal regions and presentation properties requiring redraw.
Line indices are zero-based, unique, and sorted when added through methods; public mutation or deserialization can bypass those invariants. No row bound is stored or checked.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean();
damage.mark_line(3);
assert_eq!(damage.dirty_lines, vec![3]);Fields§
§full: booltrue requests repaint of the complete grid.
dirty_lines: Vec<usize>Sorted unique zero-based rows dirtied through the API.
cursor_dirty: booltrue requests cursor repaint.
title_dirty: booltrue requests title refresh.
Implementations§
Source§impl TerminalDamage
impl TerminalDamage
Sourcepub fn clean() -> Self
pub fn clean() -> Self
Creates a snapshot with no pending grid, cursor, or title damage.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let damage = TerminalDamage::clean();
assert!(!damage.full && damage.dirty_lines.is_empty());Sourcepub fn full() -> Self
pub fn full() -> Self
Creates a full-grid snapshot with cursor and title both dirty.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let damage = TerminalDamage::full();
assert!(damage.full && damage.cursor_dirty && damage.title_dirty);Sourcepub fn mark_full(&mut self)
pub fn mark_full(&mut self)
Requests full-grid and cursor repaint and clears individual rows.
The existing title_dirty value is preserved.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean();
damage.mark_line(2);
damage.mark_full();
assert!(damage.full && damage.cursor_dirty && damage.dirty_lines.is_empty());Sourcepub fn mark_line(&mut self, line: usize)
pub fn mark_line(&mut self, line: usize)
Adds one zero-based line index, maintaining sorted uniqueness.
Values outside the actual terminal height are accepted.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean();
damage.mark_line(4); damage.mark_line(1); damage.mark_line(4);
assert_eq!(damage.dirty_lines, vec![1, 4]);Sourcepub fn mark_range(&mut self, start: usize, end_inclusive: usize)
pub fn mark_range(&mut self, start: usize, end_inclusive: usize)
Adds every line in an inclusive range.
start > end_inclusive is an empty no-op. Work and storage are linear
in the range length, and indices are not bounded to a screen height.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean();
damage.mark_range(2, 4);
assert_eq!(damage.dirty_lines, vec![2, 3, 4]);Sourcepub fn mark_cursor(&mut self)
pub fn mark_cursor(&mut self)
Requests a cursor repaint.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean(); damage.mark_cursor();
assert!(damage.cursor_dirty);Sourcepub fn mark_title(&mut self)
pub fn mark_title(&mut self)
Requests a title refresh.
§Examples
use ailloli_ui_terminal_core::TerminalDamage;
let mut damage = TerminalDamage::clean(); damage.mark_title();
assert!(damage.title_dirty);Trait Implementations§
Source§impl Clone for TerminalDamage
impl Clone for TerminalDamage
Source§fn clone(&self) -> TerminalDamage
fn clone(&self) -> TerminalDamage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more