diff options
| -rw-r--r-- | src/app.rs | 19 | ||||
| -rw-r--r-- | src/tui/commands.rs | 14 |
2 files changed, 25 insertions, 8 deletions
@@ -173,23 +173,29 @@ impl App { InputCmdAction::Nothing => {} InputCmdAction::Handle(event) => { self.input.handle_event(&event); - self.bibiman.search_list_by_pattern(&self.input); + if let CurrentArea::SearchArea = self.bibiman.current_area { + self.bibiman.search_list_by_pattern(&self.input); + } } InputCmdAction::Enter => { self.input_mode = true; // Logic for TABS to be added - self.bibiman.enter_search_area(); + // self.bibiman.enter_search_area(); } InputCmdAction::Confirm => { self.input = Input::default(); self.input_mode = false; // Logic for TABS to be added - self.bibiman.confirm_search(); + if let CurrentArea::SearchArea = self.bibiman.current_area { + self.bibiman.confirm_search(); + } } InputCmdAction::Exit => { self.input = Input::default(); self.input_mode = false; - self.bibiman.break_search(); + if let CurrentArea::SearchArea = self.bibiman.current_area { + self.bibiman.break_search(); + } } }, CmdAction::SelectNextRow(amount) => match self.bibiman.current_area { @@ -263,7 +269,10 @@ impl App { CmdAction::ToggleArea => { self.bibiman.toggle_area(); } - CmdAction::SearchList => {} + CmdAction::SearchList => { + self.input_mode = true; + self.bibiman.enter_search_area(); + } CmdAction::Reset => { if let CurrentArea::PopupArea = self.bibiman.current_area { if let Some(PopupKind::Help) = self.bibiman.popup_area.popup_kind { diff --git a/src/tui/commands.rs b/src/tui/commands.rs index 626b11b..f7fd75b 100644 --- a/src/tui/commands.rs +++ b/src/tui/commands.rs @@ -132,16 +132,24 @@ impl From<KeyEvent> for CmdAction { // Switch selected area KeyCode::Tab => Self::ToggleArea, KeyCode::BackTab => Self::ToggleArea, + // // Enter search mode + // KeyCode::Char('/') => Self::Input(InputCmdAction::Enter), + // KeyCode::Char('f') => { + // if key_event.modifiers == KeyModifiers::CONTROL { + // Self::Input(InputCmdAction::Enter) + // } else { + // Self::Nothing + // } + // } // Enter search mode - KeyCode::Char('/') => Self::Input(InputCmdAction::Enter), + KeyCode::Char('/') => Self::SearchList, KeyCode::Char('f') => { if key_event.modifiers == KeyModifiers::CONTROL { - Self::Input(InputCmdAction::Enter) + Self::SearchList } else { Self::Nothing } } - // KeyCode::Backspace => Self::Input(InputCommand::Resume(Event::Key(key_event))), // Confirm selection KeyCode::Enter => Self::Confirm, // Reset lists/tables |
