mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 23:46:41 +02:00
WIP
This commit is contained in:
parent
e65de3176a
commit
5f92b3ed5c
1 changed files with 43 additions and 2 deletions
|
@ -42,7 +42,47 @@ pub struct TaskReport {
|
||||||
|
|
||||||
impl TaskReport {
|
impl TaskReport {
|
||||||
pub fn new() -> Self {
|
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::<Vec<_>>();
|
||||||
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn report(mut self, report: String) -> Self {
|
pub fn report(mut self, report: String) -> Self {
|
||||||
|
@ -416,6 +456,7 @@ impl TaskReport {
|
||||||
if highlight_first_element {
|
if highlight_first_element {
|
||||||
self.state.select(Some(0));
|
self.state.select(Some(0));
|
||||||
}
|
}
|
||||||
|
self.update_tags();
|
||||||
} else {
|
} else {
|
||||||
imported?;
|
imported?;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +513,7 @@ impl TaskReport {
|
||||||
|
|
||||||
pub fn calculate_widths(&self, maximum_available_width: u16) -> Vec<usize> {
|
pub fn calculate_widths(&self, maximum_available_width: u16) -> Vec<usize> {
|
||||||
// naive implementation of calculate widths
|
// naive implementation of calculate widths
|
||||||
let mut widths = self.labels.iter().map(String::len).collect::<Vec<usize>>();
|
let mut widths = self.labels.iter().map(|s| s.len()).collect::<Vec<usize>>();
|
||||||
for i in 0..self.labels.len() {
|
for i in 0..self.labels.len() {
|
||||||
let max_width = self.rows.iter().map(|row| row[i].len()).max().unwrap_or(0);
|
let max_width = self.rows.iter().map(|row| row[i].len()).max().unwrap_or(0);
|
||||||
if max_width == 0 {
|
if max_width == 0 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue