From 34274dfb9dc8ff3e880d45021b627f567fb5b732 Mon Sep 17 00:00:00 2001 From: Penwing Date: Thu, 1 Feb 2024 14:04:31 +0100 Subject: [PATCH] fixed terminal output stopping at empty line --- src/main.rs | 2 +- src/panels/terminal/linux_terminal.rs | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/main.rs b/src/main.rs index c3985ab..6047577 100644 --- a/src/main.rs +++ b/src/main.rs @@ -151,7 +151,7 @@ impl eframe::App for Calcifer { style.text_styles = [ (Heading, FontId::new(self.font_size * 1.6, 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)), (Small, FontId::new(self.font_size, FontFamily::Proportional)), ] diff --git a/src/panels/terminal/linux_terminal.rs b/src/panels/terminal/linux_terminal.rs index 395c573..573d9f7 100644 --- a/src/panels/terminal/linux_terminal.rs +++ b/src/panels/terminal/linux_terminal.rs @@ -69,7 +69,7 @@ impl CommandEntry { let mut output = String::new(); loop { 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))); output = "".to_string() } else { @@ -80,7 +80,7 @@ impl CommandEntry { let mut error = String::new(); loop { 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))); error = "".to_string() } else { @@ -90,32 +90,10 @@ impl CommandEntry { if let Ok(Some(_exit_status)) = buffer.child.try_wait() { //self.result.push(Line::output(format!("Command finished with status: {:?}\n", exit_status))); - self.buffer_dump(); 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) { let mut txt: String = "".to_string();