From d9b0f8415649ecda56081d62d710f7d35d43442b Mon Sep 17 00:00:00 2001 From: SoapyDev <89493790+SoapyDev@users.noreply.github.com> Date: Sun, 4 Aug 2024 18:25:44 -0400 Subject: [PATCH 1/2] Fix: / and q are treated as character in search --- src/main.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3d82461c..b0f1b844 100644 --- a/src/main.rs +++ b/src/main.rs @@ -142,15 +142,6 @@ fn run(terminal: &mut Terminal, state: &AppState) -> io::Result<( command_opt = None; } } else { - if key.code == KeyCode::Char('q') { - return Ok(()); - } - //Activate search mode if the forward slash key gets pressed - if key.code == KeyCode::Char('/') { - // Enter search mode - in_search_mode = true; - continue; - } //Insert user input into the search bar if in_search_mode { match key.code { @@ -175,6 +166,19 @@ fn run(terminal: &mut Terminal, state: &AppState) -> io::Result<( } } else if let Some(cmd) = custom_list.handle_key(key, state) { command_opt = Some(RunningCommand::new(cmd, state)); + } else { + + // Handle keys while not in search mode + match key.code { + // Exit the program + KeyCode::Char('q') => return Ok(()), + //Activate search mode if the forward slash key gets pressed + KeyCode::Char('/') => { + in_search_mode = true; + continue; + }, + _ => {} + } } } } From 2ff6a3fa9cd2517aacfdb012776ad8ef04086e5e Mon Sep 17 00:00:00 2001 From: SoapyDev <89493790+SoapyDev@users.noreply.github.com> Date: Mon, 5 Aug 2024 08:54:19 -0400 Subject: [PATCH 2/2] Reformatting --- src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b0f1b844..f00382fb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,7 +167,6 @@ fn run(terminal: &mut Terminal, state: &AppState) -> io::Result<( } else if let Some(cmd) = custom_list.handle_key(key, state) { command_opt = Some(RunningCommand::new(cmd, state)); } else { - // Handle keys while not in search mode match key.code { // Exit the program @@ -176,7 +175,7 @@ fn run(terminal: &mut Terminal, state: &AppState) -> io::Result<( KeyCode::Char('/') => { in_search_mode = true; continue; - }, + } _ => {} } }