pub struct LineViewport { /* private fields */ }Expand description
The buffer line viewport in a buffer.
Implementations§
Source§impl LineViewport
impl LineViewport
Sourcepub fn new(
rows: LiteMap<u16, RowViewport>,
start_filled_cols: usize,
end_filled_cols: usize,
) -> Self
pub fn new( rows: LiteMap<u16, RowViewport>, start_filled_cols: usize, end_filled_cols: usize, ) -> Self
Make new instance.
Sourcepub fn rows(&self) -> &LiteMap<u16, RowViewport>
pub fn rows(&self) -> &LiteMap<u16, RowViewport>
Maps row_idx (in the window) => its row-wise viewport.
The row index starts from 0.
Sourcepub fn start_filled_cols(&self) -> usize
pub fn start_filled_cols(&self) -> usize
Get extra filled columns at the beginning of the line.
For most cases, this value should be zero. But when the first char (indicate by
start_char_idx) doesn’t show at the first column of the row, and meanwhile the cells width
is not enough for the previous character.
For example:
Column index in viewport -> 0 4
| |
0 10 20 30 36 | 37 <- Char index in the buffer
| | | | | | |
|---------------------|
This is the beginning of the buffer.<--H|T-->But it begins to |show at here.
The second line is really short! | |
Too short to show in viewport, luckily t|he third line is ok. |
|---------------------|The example shows the first char B starts at column index 4 in the viewport, and its
previous char <--HT--> uses 8 cells width so cannot fully shows in the viewport.
In this case, the variable start_filled_cols is 4, the start char index is 37.
Sourcepub fn end_filled_cols(&self) -> usize
pub fn end_filled_cols(&self) -> usize
Get extra filled columns at the end of the row.
Trait Implementations§
Source§impl Clone for LineViewport
impl Clone for LineViewport
Source§fn clone(&self) -> LineViewport
fn clone(&self) -> LineViewport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LineViewport
impl RefUnwindSafe for LineViewport
impl Send for LineViewport
impl Sync for LineViewport
impl Unpin for LineViewport
impl UnwindSafe for LineViewport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more