From e07a0319f222c51d9e4e4de8caf31f6afad901c3 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Thu, 28 May 2015 17:48:21 -0700 Subject: [PATCH] Add Home/End navigation to text views. --- src/view/text_view.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/view/text_view.rs b/src/view/text_view.rs index 793befa..3372042 100644 --- a/src/view/text_view.rs +++ b/src/view/text_view.rs @@ -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),