pub struct MadView {
pub skin: MadSkin,
pub scroll: usize,
/* private fields */
}
Expand description
A MadView is like a textview but it owns everything, from the source markdown to the area and the skin, which often makes it more convenient for dynamic texts. It’s also resizeable.
Fields§
§skin: MadSkin
§scroll: usize
Implementations§
source§impl MadView
impl MadView
sourcepub const fn from(markdown: String, area: Area, skin: MadSkin) -> MadView
pub const fn from(markdown: String, area: Area, skin: MadSkin) -> MadView
make a displayed text, that is a text in an area
sourcepub fn write(&self) -> Result<(), Error>
pub fn write(&self) -> Result<(), Error>
render the markdown in the area, taking the scroll into account
pub fn write_on<W: Write>(&self, w: &mut W) -> Result<(), Error>
sourcepub fn resize(&mut self, area: &Area)
pub fn resize(&mut self, area: &Area)
sets the new area. If it’s the same as the precedent one, this operation does nothing. The scroll is kept if possible.
sourcepub fn try_scroll_lines(&mut self, lines_count: i32)
pub fn try_scroll_lines(&mut self, lines_count: i32)
set the scroll amount. lines_count can be negative
sourcepub fn try_scroll_pages(&mut self, pages_count: i32)
pub fn try_scroll_pages(&mut self, pages_count: i32)
set the scroll amount. lines_count can be negative
sourcepub fn apply_key_combination<K: Into<KeyCombination>>(&mut self, key: K) -> bool
pub fn apply_key_combination<K: Into<KeyCombination>>(&mut self, key: K) -> bool
Apply an event being a key: page_up, page_down, up and down.
Return true when the event led to a change, false when it was discarded.
It’s possible to handle the key yourself and call the try_scroll methods.
sourcepub fn apply_key_event(&mut self, key: KeyEvent) -> bool
pub fn apply_key_event(&mut self, key: KeyEvent) -> bool
Apply an event being a key: page_up, page_down, up and down.
Return true when the event led to a change, false when it was discarded.
It’s possible to handle the key yourself and call the try_scroll methods.