mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add Home/End navigation to text views.
This commit is contained in:
parent
8ee04c525f
commit
e07a0319f2
@ -207,6 +207,8 @@ impl View for TextView {
|
||||
}
|
||||
|
||||
match event {
|
||||
Event::KeyEvent(Key::Home) => self.start_line = 0,
|
||||
Event::KeyEvent(Key::End) => self.start_line = self.rows.len() - self.view_height,
|
||||
Event::KeyEvent(Key::Up) if self.start_line > 0 => self.start_line -= 1,
|
||||
Event::KeyEvent(Key::Down) if self.start_line+self.view_height < self.rows.len() => self.start_line += 1,
|
||||
Event::KeyEvent(Key::PageDown) => self.start_line = min(self.start_line+10, self.rows.len()-self.view_height),
|
||||
|
Loading…
Reference in New Issue
Block a user