diff options
| author | lukeflo | 2024-10-24 14:58:50 +0200 |
|---|---|---|
| committer | lukeflo | 2024-10-24 14:58:50 +0200 |
| commit | c01722b7b517ea5fbee942276ca9f6442cae068b (patch) | |
| tree | 6b9ae39c4fae09ba7a5feb5f21a900ae84701fa9 /src/bibiman.rs | |
| parent | f32b6a19851b8b103ac843503ab008197f0639cd (diff) | |
| download | bibiman-c01722b7b517ea5fbee942276ca9f6442cae068b.tar.gz bibiman-c01722b7b517ea5fbee942276ca9f6442cae068b.zip | |
implementig tui_input for searching
Diffstat (limited to 'src/bibiman.rs')
| -rw-r--r-- | src/bibiman.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs index 3bb731b..988bac8 100644 --- a/src/bibiman.rs +++ b/src/bibiman.rs @@ -15,12 +15,15 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. ///// +use crate::app::App; use crate::bibiman::{bibisetup::*, search::BibiSearch}; use crate::cliargs::CLIArgs; +use crate::tui::commandnew::CmdAction; use crate::{bibiman::entries::EntryTable, bibiman::keywords::TagList}; use arboard::Clipboard; use color_eyre::eyre::{Ok, Result}; use std::path::PathBuf; +use tui_input::Input; pub mod bibisetup; pub mod entries; @@ -94,7 +97,7 @@ impl Bibiman { self.entry_table = EntryTable::new(self.main_biblio.entry_list.clone()); } - // Toggle moveable list between entries and tags + /// 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); @@ -220,4 +223,14 @@ impl Bibiman { self.search_tags(); } } + + pub fn search_list_by_pattern(&mut self, searchpattern: &Input) { + self.search_struct.search_string = searchpattern.value().to_string(); + if let Some(FormerArea::EntryArea) = self.former_area { + self.search_entries(); + self.filter_tags_by_entries(); + } else if let Some(FormerArea::TagArea) = self.former_area { + self.search_tags(); + } + } } |
