diff options
| author | lukeflo | 2024-10-11 14:27:21 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-12 22:41:38 +0200 |
| commit | 2fa5f8193c2cf3b75f54a37f0f7c4b5ae9d7d665 (patch) | |
| tree | 483b113616c9a750f618c45ca332858d63758a9f /src/frontend/app.rs | |
| parent | 8e4bcaada27a50a83dba35deea8ad804d4bb226a (diff) | |
| parent | d9ed8fc8eaab1aa04aac031cc629d7018d513ab7 (diff) | |
| download | bibiman-2fa5f8193c2cf3b75f54a37f0f7c4b5ae9d7d665.tar.gz bibiman-2fa5f8193c2cf3b75f54a37f0f7c4b5ae9d7d665.zip | |
Merge branch 'scrollbar'
Diffstat (limited to 'src/frontend/app.rs')
| -rw-r--r-- | src/frontend/app.rs | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/frontend/app.rs b/src/frontend/app.rs index 0751da1..ee2ab05 100644 --- a/src/frontend/app.rs +++ b/src/frontend/app.rs @@ -33,6 +33,7 @@ pub enum CurrentArea { TagArea, SearchArea, HelpArea, + InfoArea, } // Check which area was active when popup set active @@ -137,11 +138,20 @@ impl App { // Toggle moveable list between entries and tags pub fn toggle_area(&mut self) { if let CurrentArea::EntryArea = self.current_area { + self.entry_table.entry_scroll_state = self.entry_table.entry_scroll_state.position(0); self.current_area = CurrentArea::TagArea; - self.tag_list.tag_list_state.select(Some(0)) + self.tag_list.tag_list_state.select(Some(0)); + self.tag_list.tag_scroll_state = self + .tag_list + .tag_scroll_state + .position(self.tag_list.tag_list_state.selected().unwrap()); } else if let CurrentArea::TagArea = self.current_area { self.current_area = CurrentArea::EntryArea; - self.tag_list.tag_list_state.select(None) + self.tag_list.tag_list_state.select(None); + self.entry_table.entry_scroll_state = self + .entry_table + .entry_scroll_state + .position(self.entry_table.entry_table_state.selected().unwrap()); } } @@ -165,15 +175,25 @@ impl App { } pub fn scroll_info_down(&mut self) { - self.scroll_info = self.scroll_info + 1; + // self.entry_table.entry_info_scroll = self.entry_table.entry_info_scroll + 1; + self.entry_table.entry_info_scroll = self.entry_table.entry_info_scroll.saturating_add(1); + self.entry_table.entry_info_scroll_state = self + .entry_table + .entry_info_scroll_state + .position(self.entry_table.entry_info_scroll.into()); } pub fn scroll_info_up(&mut self) { - if self.scroll_info == 0 { - {} - } else { - self.scroll_info = self.scroll_info - 1; - } + // if self.entry_table.entry_info_scroll == 0 { + // {} + // } else { + // self.entry_table.entry_info_scroll = self.entry_table.entry_info_scroll - 1; + // } + self.entry_table.entry_info_scroll = self.entry_table.entry_info_scroll.saturating_sub(1); + self.entry_table.entry_info_scroll_state = self + .entry_table + .entry_info_scroll_state + .position(self.entry_table.entry_info_scroll.into()); } // Search Area |
