Historique fonctionne
This commit is contained in:
parent
c65a6aa4d0
commit
b64505106f
@ -186,7 +186,7 @@ pub mod shell {
|
||||
|
||||
let mut stdout = stdout().into_raw_mode().unwrap();
|
||||
//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[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
|
||||
let mynumber = match get_history_number() {
|
||||
Ok(n) => n + 1,
|
||||
Err(e) => 1,
|
||||
Err(_) => 1,
|
||||
};
|
||||
|
||||
return mynumber;
|
||||
@ -81,9 +81,10 @@ pub fn get_hist_from_number(number: &i32) -> Option<String> {
|
||||
.expect("Error reading a line in hist file")
|
||||
.parse()
|
||||
.unwrap();
|
||||
let c = s.next().expect("No command!");
|
||||
//let c = s.next().expect("No command!");
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user