From 5f92b3ed5c147ebc52b163a13d8aa4b1d228e2a6 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Wed, 27 Sep 2023 06:42:03 -0400 Subject: [PATCH] WIP --- src/components/task_report.rs | 45 +++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/components/task_report.rs b/src/components/task_report.rs index 44133ab4..d980d032 100644 --- a/src/components/task_report.rs +++ b/src/components/task_report.rs @@ -42,7 +42,47 @@ pub struct TaskReport { impl TaskReport { pub fn new() -> Self { - Self::default() + let mut s = Self::default(); + s.virtual_tags = vec![ + "PROJECT", + "BLOCKED", + "UNBLOCKED", + "BLOCKING", + "DUE", + "DUETODAY", + "TODAY", + "OVERDUE", + "WEEK", + "MONTH", + "QUARTER", + "YEAR", + "ACTIVE", + "SCHEDULED", + "PARENT", + "CHILD", + "UNTIL", + "WAITING", + "ANNOTATED", + "READY", + "YESTERDAY", + "TOMORROW", + "TAGGED", + "PENDING", + "COMPLETED", + "DELETED", + "UDA", + "ORPHAN", + "PRIORITY", + "PROJECT", + "LATEST", + "RECURRING", + "INSTANCE", + "TEMPLATE", + ] + .iter() + .map(|s| s.to_string()) + .collect::>(); + s } pub fn report(mut self, report: String) -> Self { @@ -416,6 +456,7 @@ impl TaskReport { if highlight_first_element { self.state.select(Some(0)); } + self.update_tags(); } else { imported?; } @@ -472,7 +513,7 @@ impl TaskReport { pub fn calculate_widths(&self, maximum_available_width: u16) -> Vec { // naive implementation of calculate widths - let mut widths = self.labels.iter().map(String::len).collect::>(); + let mut widths = self.labels.iter().map(|s| s.len()).collect::>(); for i in 0..self.labels.len() { let max_width = self.rows.iter().map(|row| row[i].len()).max().unwrap_or(0); if max_width == 0 {