diff --git a/src/app.rs b/src/app.rs index 866c360..2439340 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1568,15 +1568,15 @@ impl TaskwarriorTui { task.arg("rc.json.array=on"); task.arg("rc.confirmation=off"); - if self.task_version >= *LATEST_TASKWARRIOR_VERSION { + if !self.filter.as_str().trim().is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION { task.arg(format!("'{}'", self.filter.as_str().trim())); - } else { + } else if !self.filter.as_str().trim().is_empty() { task.arg(self.filter.as_str().trim()); } - if !self.current_context_filter.is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION { + if !self.current_context_filter.trim().is_empty() && self.task_version >= *LATEST_TASKWARRIOR_VERSION { task.arg(format!("'{}'", self.current_context_filter.trim())); - } else if !self.current_context_filter.is_empty() { + } else if !self.current_context_filter.trim().is_empty() { task.arg(format!("'\\({}\\)'", self.current_context_filter)); } @@ -4401,18 +4401,6 @@ mod tests { test_case(&expected); } - // #[test] - fn test_app() { - let mut app = TaskwarriorTui::new("next").unwrap(); - - app.update(true).unwrap(); - - let backend = TestBackend::new(80, 20); - let mut terminal = Terminal::new(backend).unwrap(); - app.render(&mut terminal).unwrap(); - println!("{}", buffer_view(terminal.backend().buffer())); - } - // #[test] fn test_graphemes() { dbg!("写作业".graphemes(true).count()); @@ -4445,4 +4433,16 @@ mod tests { let position = TaskwarriorTui::get_position(&app.modify); dbg!(position); } + + // #[test] + fn test_app() { + let mut app = TaskwarriorTui::new("all").unwrap(); + + app.update(true).unwrap(); + + let backend = TestBackend::new(80, 20); + let mut terminal = Terminal::new(backend).unwrap(); + app.render(&mut terminal).unwrap(); + println!("{}", buffer_view(terminal.backend().buffer())); + } } diff --git a/src/config.rs b/src/config.rs index 220859f..50af9bf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -398,7 +398,9 @@ impl Config { } fn get_filter(data: &str, report: &str) -> Result { - if let Some(s) = Self::get_config( + if report == "all" { + Ok("".into()) + } else if let Some(s) = Self::get_config( format!("uda.taskwarrior-tui.task-report.{}.filter", report).as_str(), data, ) {