From bea2772b64f58cf1357aac8f65bce61f813332ff Mon Sep 17 00:00:00 2001 From: aaron-jack-manning Date: Sun, 21 Aug 2022 12:17:23 +1000 Subject: [PATCH] minor display bugs fixed for view command --- src/tasks.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/tasks.rs b/src/tasks.rs index 0b51446..4fc5214 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -208,17 +208,24 @@ impl Task { println!("Tags: [{}]", format_hash_set(&self.data.tags)?); println!("Created: {}", self.data.created); - let mut max_line_width = 0; - if let Some(info) = &self.data.info { + if let Some(mut info) = self.data.info.clone() { + let mut max_line_width = 0; println!("Info:"); + + while info.ends_with("\n") { + info.pop(); + } + let info_lines : Vec<&str> = info.split("\n").collect(); for line in info_lines { max_line_width = usize::max(max_line_width, line.chars().count() + 4); println!(" {}", line); } + line(usize::min(max_line_width, usize::try_from(termsize::get().map(|s| s.cols).unwrap_or(0)).unwrap())); + } + else { + // Need to work out appropriate line size. } - - line(usize::min(max_line_width, usize::try_from(termsize::get().map(|s| s.cols).unwrap_or(0)).unwrap())); // dependencies as a tree