Historique fonctionne
This commit is contained in:
@ -186,7 +186,7 @@ pub mod shell {
|
|||||||
|
|
||||||
let mut stdout = stdout().into_raw_mode().unwrap();
|
let mut stdout = stdout().into_raw_mode().unwrap();
|
||||||
//write!(stdout, "{}", cursor::Save);
|
//write!(stdout, "{}", cursor::Save);
|
||||||
for c in current_cmd.graphemes(true) {
|
for _c in current_cmd.graphemes(true) {
|
||||||
write!(stdout, "\x1b[D").unwrap();
|
write!(stdout, "\x1b[D").unwrap();
|
||||||
write!(stdout, "\x1b[K").unwrap();
|
write!(stdout, "\x1b[K").unwrap();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ pub fn get_curr_history_number() -> i32 {
|
|||||||
//Returns CURRENT history number, AKA the one for the command we are typing
|
//Returns CURRENT history number, AKA the one for the command we are typing
|
||||||
let mynumber = match get_history_number() {
|
let mynumber = match get_history_number() {
|
||||||
Ok(n) => n + 1,
|
Ok(n) => n + 1,
|
||||||
Err(e) => 1,
|
Err(_) => 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
return mynumber;
|
return mynumber;
|
||||||
@ -81,9 +81,10 @@ pub fn get_hist_from_number(number: &i32) -> Option<String> {
|
|||||||
.expect("Error reading a line in hist file")
|
.expect("Error reading a line in hist file")
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let c = s.next().expect("No command!");
|
//let c = s.next().expect("No command!");
|
||||||
if &n == number {
|
if &n == number {
|
||||||
return Some(String::from(c));
|
let remainder: String = s.map(|c| c.to_string()).collect::<Vec<_>>().join(" ");
|
||||||
|
return Some(String::from(remainder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
|
Reference in New Issue
Block a user