fixed terminal output stopping at empty line

This commit is contained in:
Penwing 2024-02-01 14:04:31 +01:00
parent 9155e09b48
commit 34274dfb9d
2 changed files with 3 additions and 25 deletions

View file

@ -151,7 +151,7 @@ impl eframe::App for Calcifer {
style.text_styles = [ style.text_styles = [
(Heading, FontId::new(self.font_size * 1.6, FontFamily::Proportional)), (Heading, FontId::new(self.font_size * 1.6, FontFamily::Proportional)),
(Body, FontId::new(self.font_size, FontFamily::Proportional)), (Body, FontId::new(self.font_size, FontFamily::Proportional)),
(Monospace, FontId::new(self.font_size * 0.8, FontFamily::Monospace)), (Monospace, FontId::new(self.font_size, FontFamily::Monospace)),
(Button, FontId::new(self.font_size, FontFamily::Proportional)), (Button, FontId::new(self.font_size, FontFamily::Proportional)),
(Small, FontId::new(self.font_size, FontFamily::Proportional)), (Small, FontId::new(self.font_size, FontFamily::Proportional)),
] ]

View file

@ -69,7 +69,7 @@ impl CommandEntry {
let mut output = String::new(); let mut output = String::new();
loop { loop {
let _ = buffer.output_buffer.read_line(&mut output); let _ = buffer.output_buffer.read_line(&mut output);
if !remove_line_break(output.to_string()).is_empty() { if !output.to_string().is_empty() {
self.result.push(Line::output(format!("{}\n", output))); self.result.push(Line::output(format!("{}\n", output)));
output = "".to_string() output = "".to_string()
} else { } else {
@ -80,7 +80,7 @@ impl CommandEntry {
let mut error = String::new(); let mut error = String::new();
loop { loop {
let _ = buffer.error_buffer.read_line(&mut error); let _ = buffer.error_buffer.read_line(&mut error);
if !remove_line_break(error.to_string()).is_empty() { if !error.to_string().is_empty() {
self.result.push(Line::error(format!("{}\n", error))); self.result.push(Line::error(format!("{}\n", error)));
error = "".to_string() error = "".to_string()
} else { } else {
@ -90,32 +90,10 @@ impl CommandEntry {
if let Ok(Some(_exit_status)) = buffer.child.try_wait() { if let Ok(Some(_exit_status)) = buffer.child.try_wait() {
//self.result.push(Line::output(format!("Command finished with status: {:?}\n", exit_status))); //self.result.push(Line::output(format!("Command finished with status: {:?}\n", exit_status)));
self.buffer_dump();
self.finished = true; self.finished = true;
} }
} }
} }
fn buffer_dump(&mut self) {
// if self.buffer.is_none() {
// return
// }
//
// let output_buffer = &self.buffer.as_ref().unwrap().output_buffer;
// for line in output_buffer.lines() {
// match line {
// Ok(line) => self.result.push(Line::output(format!("{}\n", line))),
// Err(_) => return,
// }
// }
// let error_buffer = &self.buffer.as_ref().unwrap().error_buffer;
// for line in error_buffer.lines() {
// match line {
// Ok(line) => self.result.push(Line::error(format!("{}\n", line))),
// Err(_) => return,
// }
// }
}
pub fn copy_error_code(&self) { pub fn copy_error_code(&self) {
let mut txt: String = "".to_string(); let mut txt: String = "".to_string();