Del implemented
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Justine Pelletreau
2023-02-03 20:10:14 +01:00
parent 4d5cc2fa65
commit b31e3d4be4
2 changed files with 17 additions and 1 deletions

View File

@ -349,6 +349,22 @@ pub mod shell {
},
Key::Delete => {
if current_pos >= 0 && current_pos < max_pos {
mycommand.remove(current_pos);
if current_pos > 0 {
current_pos -= 1;
write!(stdout, "{}", cursor::Left(1));
}
max_pos -= 1;
write!(stdout, "{}", cursor::Save);
clear_line(&max_pos, &current_pos);
write!(stdout, "{}", mycommand);
write!(stdout, "{}", cursor::Restore);
stdout.flush();
}
},
Key::Backspace => {
if current_pos > 0 {
current_pos -= 1;

View File

@ -107,7 +107,7 @@ impl Search {
fn discriminate_search_type(input: &String) -> SearchType {
let tamere = input.clone();
let mut a = tamere.split(" ").collect::<Vec<&str>>();
let y = String::from(a.pop().unwrap());
let _y = String::from(a.pop().unwrap());
let mut x = String::from(a.join(" ").trim());
if x.len() > 0 {
x.push_str(" ")