diff options
| author | Aram Drevekenin <aram@poor.dev> | 2020-10-15 17:58:07 +0200 |
|---|---|---|
| committer | Aram Drevekenin <aram@poor.dev> | 2020-10-15 17:58:07 +0200 |
| commit | 6a68f4c71041eae8c847a9b368cc5ccd8d16f047 (patch) | |
| tree | 5849bd3466849d5129b90c236b47039c5359fcbf /src/screen.rs | |
| parent | fix(vim): properly delete last line (diff) | |
| download | sl0ppij-6a68f4c71041eae8c847a9b368cc5ccd8d16f047.tar.gz sl0ppij-6a68f4c71041eae8c847a9b368cc5ccd8d16f047.tar.xz sl0ppij-6a68f4c71041eae8c847a9b368cc5ccd8d16f047.zip | |
feat(scrolling): basic 1-line scroll-up and scroll-down inside a pane
Diffstat (limited to 'src/screen.rs')
| -rw-r--r-- | src/screen.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/screen.rs b/src/screen.rs index f35f1072..0c68bfa4 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -58,6 +58,9 @@ pub enum ScreenInstruction { ResizeUp, MoveFocus, Quit, + ScrollUp, + ScrollDown, + ClearScroll, } pub struct Screen { @@ -823,4 +826,27 @@ impl Screen { } self.render(); } + pub fn scroll_active_terminal_up(&mut self) { + if let Some(active_terminal_id) = self.get_active_terminal_id() { + let active_terminal = self.terminals.get_mut(&active_terminal_id).unwrap(); + active_terminal.scroll_up(1); + self.render(); + } + } + pub fn scroll_active_terminal_down(&mut self) { + if let Some(active_terminal_id) = self.get_active_terminal_id() { + let active_terminal = self.terminals.get_mut(&active_terminal_id).unwrap(); + active_terminal.scroll_down(1); + self.render(); + } + } + pub fn clear_active_terminal_scroll(&mut self) { + if let Some(active_terminal_id) = self.get_active_terminal_id() { + let active_terminal = self.terminals.get_mut(&active_terminal_id).unwrap(); + if active_terminal.scroll_up_count.is_some() { + active_terminal.clear_scroll(); + self.render(); + } + } + } } |
