pub struct UiModel {
pub columns: usize,
pub rows: usize,
cur_row: usize,
cur_col: usize,
model: Box<[Line]>,
}Fields
columns: usizerows: usizecur_row: usizecur_col: usizemodel: Box<[Line]>Implementations
sourceimpl UiModel
impl UiModel
pub fn new(rows: u64, columns: u64) -> UiModel
pub fn empty() -> UiModel
pub fn model(&self) -> &[Line]
pub fn model_mut(&mut self) -> &mut [Line]
pub fn cur_point(&self) -> ModelRect
pub fn set_cursor(&mut self, row: usize, col: usize) -> ModelRectVec
pub fn get_cursor(&self) -> (usize, usize)
pub fn put_one(
&mut self,
row: usize,
col: usize,
ch: &str,
double_width: bool,
hl: Rc<Highlight>
)
pub fn put(
&mut self,
row: usize,
col: usize,
ch: &str,
double_width: bool,
repeat: usize,
hl: Rc<Highlight>
)
sourcepub fn swap_rows(&mut self, target: &mut UiModel, to_row: usize)
pub fn swap_rows(&mut self, target: &mut UiModel, to_row: usize)
Copy rows from 0 to to_row, col from 0 self.columns
Don’t do any validation!
fn swap_row(
&mut self,
target_row: i64,
offset: i64,
left_col: usize,
right_col: usize
)
pub fn scroll(
&mut self,
top: i64,
bot: i64,
left: usize,
right: usize,
count: i64,
default_hl: &Rc<Highlight>
) -> ModelRect
pub fn clear(&mut self, default_hl: &Rc<Highlight>)
fn clear_region(
&mut self,
top: usize,
bot: usize,
left: usize,
right: usize,
default_hl: &Rc<Highlight>
)
pub fn clear_glyphs(&mut self)
Trait Implementations
sourceimpl ModelClipIteratorFactory for UiModel
impl ModelClipIteratorFactory for UiModel
Clip implemented as top - 1/bot + 1 this is because in some cases(like ‘g’ character) drawing character does not fit to calculated bounds and if one line must be repainted - also previous and next line must be repainted to
fn get_row_view<'a>(
&'a self,
ctx: &'a Context,
cell_metrics: &'a CellMetrics,
col: usize
) -> RowView<'a>
fn get_clip_iterator<'a>(
&'a self,
ctx: &'a Context,
cell_metrics: &'a CellMetrics
) -> ModelClipIterator<'a>ⓘNotable traits for ModelClipIterator<'a>impl<'a> Iterator for ModelClipIterator<'a> type Item = RowView<'a>;
Auto Trait Implementations
impl RefUnwindSafe for UiModel
impl !Send for UiModel
impl !Sync for UiModel
impl Unpin for UiModel
impl UnwindSafe for UiModel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more