mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Fix: / and q are treated as character in search
This commit is contained in:
parent
6f865f76ef
commit
d9b0f84156
22
src/main.rs
22
src/main.rs
|
@ -142,15 +142,6 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
|
||||||
command_opt = None;
|
command_opt = None;
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
//Insert user input into the search bar
|
||||||
if in_search_mode {
|
if in_search_mode {
|
||||||
match key.code {
|
match key.code {
|
||||||
|
@ -175,6 +166,19 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
|
||||||
}
|
}
|
||||||
} else if let Some(cmd) = custom_list.handle_key(key, state) {
|
} else if let Some(cmd) = custom_list.handle_key(key, state) {
|
||||||
command_opt = Some(RunningCommand::new(cmd, 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;
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user