Struct UiModel

Source
pub struct UiModel {
    pub columns: usize,
    pub rows: usize,
    cur_row: usize,
    cur_col: usize,
    model: Box<[Line]>,
}

Fields§

§columns: usize§rows: usize§cur_row: usize§cur_col: usize§model: Box<[Line]>

Implementations§

Source§

impl UiModel

Source

pub fn new(rows: u64, columns: u64) -> UiModel

Source

pub fn empty() -> UiModel

Source

pub fn model(&self) -> &[Line]

Source

pub fn model_mut(&mut self) -> &mut [Line]

Source

pub fn cur_point(&self) -> ModelRect

Source

pub fn set_cursor(&mut self, row: usize, col: usize) -> ModelRectVec

Source

pub fn get_cursor(&self) -> (usize, usize)

Source

pub fn put_one( &mut self, row: usize, col: usize, ch: &str, double_width: bool, hl: Rc<Highlight>, )

Source

pub fn put( &mut self, row: usize, col: usize, ch: &str, double_width: bool, repeat: usize, hl: Rc<Highlight>, )

Source

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!

Source

fn swap_row( &mut self, target_row: i64, offset: i64, left_col: usize, right_col: usize, )

Source

pub fn scroll( &mut self, top: i64, bot: i64, left: usize, right: usize, count: i64, default_hl: &Rc<Highlight>, ) -> ModelRect

Source

pub fn clear(&mut self, default_hl: &Rc<Highlight>)

Source

fn clear_region( &mut self, top: usize, bot: usize, left: usize, right: usize, default_hl: &Rc<Highlight>, )

Source

pub fn clear_glyphs(&mut self)

Trait Implementations§

Source§

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

Source§

fn get_row_view<'a>( &'a self, ctx: &'a Context, cell_metrics: &'a CellMetrics, col: usize, ) -> RowView<'a>

Source§

fn get_clip_iterator<'a>( &'a self, ctx: &'a Context, cell_metrics: &'a CellMetrics, ) -> ModelClipIterator<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.