diff options
| author | lukeflo | 2024-11-14 14:15:35 +0100 |
|---|---|---|
| committer | lukeflo | 2024-11-14 14:15:35 +0100 |
| commit | ca51eea300b84a6fa865c6f3e00823a8099bb9bc (patch) | |
| tree | 920a86a4466ed7172afc1351f7a454c75afb6745 /src/tui/popup.rs | |
| parent | 5731d4a302ee7eabd78d67ec254e2bf09c06d086 (diff) | |
| download | bibiman-ca51eea300b84a6fa865c6f3e00823a8099bb9bc.tar.gz bibiman-ca51eea300b84a6fa865c6f3e00823a8099bb9bc.zip | |
implement scrolling for help popup
Diffstat (limited to 'src/tui/popup.rs')
| -rw-r--r-- | src/tui/popup.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/tui/popup.rs b/src/tui/popup.rs index 20ff467..fe76956 100644 --- a/src/tui/popup.rs +++ b/src/tui/popup.rs @@ -35,6 +35,7 @@ pub struct PopupArea { pub is_popup: bool, pub popup_kind: Option<PopupKind>, pub popup_message: String, + pub popup_scroll_pos: u16, pub popup_list: Vec<String>, pub popup_state: ListState, } @@ -45,6 +46,7 @@ impl Default for PopupArea { is_popup: false, popup_kind: None, popup_message: String::new(), + popup_scroll_pos: 0, popup_list: Vec::new(), popup_state: ListState::default(), } @@ -146,9 +148,11 @@ impl PopupArea { self.is_popup = true; } - pub fn popup_close_message(&mut self) { - self.is_popup = false; - self.popup_message.clear(); - self.popup_kind = None + pub fn popup_scroll_down(&mut self) { + self.popup_scroll_pos = self.popup_scroll_pos.saturating_add(1) + } + + pub fn popup_scroll_up(&mut self) { + self.popup_scroll_pos = self.popup_scroll_pos.saturating_sub(1) } } |
