aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukeflo2024-12-15 12:29:00 +0100
committerlukeflo2024-12-23 21:03:19 +0100
commitb892bc9a66e65cb73901d719c83768face67941d (patch)
tree61d64d320056caa636814b692fa19b1ef2283008
parentbe72bac936515007b4fd9a30632f62ee19839bf8 (diff)
downloadbibiman-b892bc9a66e65cb73901d719c83768face67941d.tar.gz
bibiman-b892bc9a66e65cb73901d719c83768face67941d.zip
use specific search command for entering search input mode
-rw-r--r--src/app.rs19
-rw-r--r--src/tui/commands.rs14
2 files changed, 25 insertions, 8 deletions
diff --git a/src/app.rs b/src/app.rs
index a200448..2834e61 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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