diff options
author | rabite <rabite@posteo.de> | 2019-03-09 23:40:13 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-03-09 23:40:13 +0100 |
commit | 9ef59ba0501f7d29edc42c6861ff259ab1914b37 (patch) | |
tree | 3b13077b1d02f7ff11d95a95ba6cf8f84b136fe9 /src/proclist.rs | |
parent | 67e1616efbaaf85d4990a3c89760324d48be7084 (diff) |
scrolling and following proc output
Diffstat (limited to 'src/proclist.rs')
-rw-r--r-- | src/proclist.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/proclist.rs b/src/proclist.rs index c758980..e2468db 100644 --- a/src/proclist.rs +++ b/src/proclist.rs @@ -261,6 +261,41 @@ impl ProcView { self.viewing = Some(self.get_listview().get_selection()); Ok(()) } + + pub fn toggle_follow(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.toggle_follow(); + Ok(()) + } + + pub fn scroll_up(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.scroll_up(); + Ok(()) + } + + pub fn scroll_down(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.scroll_down(); + Ok(()) + } + + pub fn page_up(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.page_up(); + Ok(()) + } + + pub fn page_down(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.page_down(); + Ok(()) + } + + pub fn scroll_top(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.scroll_top(); + Ok(()) + } + + pub fn scroll_bottom(&mut self) -> HResult<()> { + self.get_textview().widget()?.lock()?.as_mut()?.scroll_bottom(); + Ok(()) + } } impl Widget for ProcView { @@ -293,6 +328,13 @@ impl Widget for ProcView { Key::Down | Key::Char('n') => { self.get_listview().move_down(); } + Key::Char('f') => { self.toggle_follow().log(); } + Key::Ctrl('n') => { self.scroll_down().log(); }, + Key::Ctrl('p') => { self.scroll_up().log(); }, + Key::Ctrl('v') => { self.page_down().log(); }, + Key::Alt('v') => { self.page_up().log(); }, + Key::Char('>') => { self.scroll_bottom().log(); }, + Key::Char('<') => { self.scroll_top().log(); } _ => {} } self.refresh().log(); |