Fixed line returns

This commit is contained in:
Justine
2023-02-20 00:16:24 +01:00
parent ed5d405649
commit c9eb3b90df
3 changed files with 6 additions and 18 deletions

View File

@ -101,7 +101,7 @@ pub mod shell {
.spawn() {
Ok(h) => h,
Err(_) => {
let err_string = format!("Command not found : {}\r\n", command);
let err_string = format!("Not found : {}", command);
return String::from(err_string);
},
};
@ -215,19 +215,19 @@ pub mod shell {
if conf.aliases.contains_key(mycommand) {
*mycommand = conf.aliases[mycommand].clone();
}
if (mycommand != &String::from("\n")) && (mycommand != &String::from("exit")) {
if (mycommand != &String::from("")) && (mycommand != &String::from("exit")) {
let comm = replace_signs(&mycommand);
RawTerminal::suspend_raw_mode(&stdout);
let res = handle_input(&comm);
RawTerminal::activate_raw_mode(&stdout);
mycommand.clear();
for line in res.split('\n') {
if line != "\r" {
write!(stdout, "\r\n{}", line);
for line in res.split("\r\n") {
if line != "" && line.starts_with('N'){
write!(stdout, "{}\r\n", line);
}
}
conf.update_prompt(get_curr_history_number());
write!(stdout, "\r\n{}", conf.promptline).unwrap();
write!(stdout, "{}", conf.promptline).unwrap();
stdout.flush();
*current_number += 1;
} else if mycommand == &String::from("exit") {