Struct fm::content_window::ContentWindow
source · Expand description
Holds the information about the displayed window of lines.
When there’s too much lines to display in one screen, we can scroll
and this struct is responsible for that.
Scrolling is done with scroll_to, scroll_up_one, scroll_down_one
methods.
Fields§
§top: usizeThe index of the first displayed file.
bottom: usizeThe index of the last displayed file.
len: usizeThe number of displayble file in the current folder.
height: usizeThe height of the terminal.
Implementations§
source§impl ContentWindow
impl ContentWindow
sourcepub fn new(len: usize, height: usize) -> Self
pub fn new(len: usize, height: usize) -> Self
Returns a new ContentWindow instance with values depending of
number of files and height of the terminal screen.
sourcepub const WINDOW_MARGIN_TOP: usize = 2usize
pub const WINDOW_MARGIN_TOP: usize = 2usize
The space of the top element
sourcepub fn set_height(&mut self, height: usize)
pub fn set_height(&mut self, height: usize)
How many rows are reserved at bottom Set the height of file window.
sourcepub fn scroll_up_one(&mut self, index: usize)
pub fn scroll_up_one(&mut self, index: usize)
Move the window one line up if possible. Does nothing if the index can’t be reached.
sourcepub fn scroll_down_one(&mut self, index: usize)
pub fn scroll_down_one(&mut self, index: usize)
Move the window one line down if possible. Does nothing if the index can’t be reached.
Trait Implementations§
source§impl Clone for ContentWindow
impl Clone for ContentWindow
source§fn clone(&self) -> ContentWindow
fn clone(&self) -> ContentWindow
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more