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/bibiman.rs | |
| parent | 5731d4a302ee7eabd78d67ec254e2bf09c06d086 (diff) | |
| download | bibiman-ca51eea300b84a6fa865c6f3e00823a8099bb9bc.tar.gz bibiman-ca51eea300b84a6fa865c6f3e00823a8099bb9bc.zip | |
implement scrolling for help popup
Diffstat (limited to 'src/bibiman.rs')
| -rw-r--r-- | src/bibiman.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs index f3d9272..ed6a66f 100644 --- a/src/bibiman.rs +++ b/src/bibiman.rs @@ -108,16 +108,19 @@ impl Bibiman { self.popup_area.popup_kind = Some(PopupKind::Help); } - pub fn go_back(&mut self) { - if let CurrentArea::PopupArea = self.current_area { - self.popup_area.is_popup = false; - self.popup_area.popup_kind = None; - if let Some(FormerArea::EntryArea) = self.former_area { - self.current_area = CurrentArea::EntryArea - } else if let Some(FormerArea::TagArea) = self.former_area { - self.current_area = CurrentArea::TagArea - } - }; + pub fn close_popup(&mut self) { + // Reset all popup fields to default values + self.popup_area = PopupArea::default(); + + // Go back to previously selected area + if let Some(FormerArea::EntryArea) = self.former_area { + self.current_area = CurrentArea::EntryArea + } else if let Some(FormerArea::TagArea) = self.former_area { + self.current_area = CurrentArea::TagArea + } + + // Clear former_area field + self.former_area = None; } pub fn update_lists(&mut self) { |
