From ca51eea300b84a6fa865c6f3e00823a8099bb9bc Mon Sep 17 00:00:00 2001 From: lukeflo Date: Thu, 14 Nov 2024 14:15:35 +0100 Subject: implement scrolling for help popup --- src/bibiman.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/bibiman.rs') 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) { -- cgit v1.2.3