fix: Resolve empty task list filter bug 🐛

This commit is contained in:
Dheepak Krishnamurthy 2021-11-01 10:56:01 -06:00
parent 8d21885a18
commit 786f76ecaf

View file

@ -1572,10 +1572,9 @@ impl TaskwarriorTui {
task.arg("rc.confirmation=off"); task.arg("rc.confirmation=off");
let filter = if self.current_context_filter.is_empty() { let filter = if self.current_context_filter.is_empty() {
self.filter.as_str().into() format!("'{}'", self.filter.as_str())
} else { } else {
let t = format!("{} '{}'", self.filter.as_str(), self.current_context_filter); format!("'{}' '{}'", self.filter.as_str(), self.current_context_filter)
t
}; };
match shlex::split(&filter) { match shlex::split(&filter) {
@ -3436,11 +3435,7 @@ mod tests {
#[test] #[test]
fn test_taskwarrior_tui() { fn test_taskwarrior_tui() {
let app = TaskwarriorTui::new("next"); let app = TaskwarriorTui::new("next").unwrap();
if let Err(_) = app {
return;
}
let app = app.unwrap();
assert!(app.task_by_index(0).is_none()); assert!(app.task_by_index(0).is_none());
let app = TaskwarriorTui::new("next").unwrap(); let app = TaskwarriorTui::new("next").unwrap();
@ -3840,7 +3835,7 @@ mod tests {
"│ │", "│ │",
"╰────────────────────────────────────────────────╯", "╰────────────────────────────────────────────────╯",
"╭Filter Tasks────────────────────────────────────╮", "╭Filter Tasks────────────────────────────────────╮",
"status:pending -private ", "(status:pending or status:waiting)",
"╰────────────────────────────────────────────────╯", "╰────────────────────────────────────────────────╯",
]); ]);
@ -4135,7 +4130,7 @@ mod tests {
"│ID 27 │", "│ID 27 │",
"╰────────────────────────────────────────────────╯", "╰────────────────────────────────────────────────╯",
"╭Filter Tasks────────────────────────────────────╮", "╭Filter Tasks────────────────────────────────────╮",
"status:pending -private ", "(status:pending or status:waiting)",
"╰────────────────────────────────────────────────╯", "╰────────────────────────────────────────────────╯",
]); ]);