From 2ed43ea6d412438eee69d91aa9b900ea5cfc4534 Mon Sep 17 00:00:00 2001 From: aaron-jack-manning Date: Sun, 21 Aug 2022 11:48:30 +1000 Subject: [PATCH] minor changes to task display --- src/tasks.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tasks.rs b/src/tasks.rs index 224f094..0b51446 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -208,15 +208,21 @@ 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 { println!("Info:"); - // Figure out how to indent this properly: - println!("\t{}", info); + 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); + } } - Ok(()) + line(usize::min(max_line_width, usize::try_from(termsize::get().map(|s| s.cols).unwrap_or(0)).unwrap())); // dependencies as a tree + + Ok(()) } }