diff --git a/src/main.rs b/src/main.rs
index 2fcdeb3..b796825 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -741,7 +741,7 @@ async fn main() -> Result<()> {
}
let filtered =
- tasks.get_filtered(|t| {
+ tasks.get_filtered(pos, |t| {
transform(&t.event.content).contains(&remaining) ||
t.tags.iter().flatten().any(
|tag| tag.content().is_some_and(|s| transform(s).contains(&remaining)))
diff --git a/src/tasks.rs b/src/tasks.rs
index 8239a0c..bf05b95 100644
--- a/src/tasks.rs
+++ b/src/tasks.rs
@@ -490,7 +490,8 @@ impl TasksRelay {
current
}
- pub(crate) fn visible_tasks(&self) -> Vec<&Task> {
+ // TODO this is a relict for tests
+ fn visible_tasks(&self) -> Vec<&Task> {
if self.search_depth == 0 {
return vec![];
}
@@ -589,11 +590,11 @@ impl TasksRelay {
self.set_filter(|t| t.last_state_update() > time)
}
- pub(crate) fn get_filtered
(&self, predicate: P) -> Vec
+ pub(crate) fn get_filtered(&self, position: Option<&EventId>, predicate: P) -> Vec
where
P: Fn(&&Task) -> bool,
{
- self.filtered_tasks(self.get_position_ref(), false)
+ self.filtered_tasks(position, false)
.into_iter()
.filter(predicate)
.map(|t| t.event.id)
@@ -604,7 +605,7 @@ impl TasksRelay {
where
P: Fn(&&Task) -> bool,
{
- self.set_view(self.get_filtered(predicate))
+ self.set_view(self.get_filtered(self.get_position_ref(), predicate))
}
pub(crate) fn set_view_bookmarks(&mut self) -> bool {
@@ -1158,8 +1159,8 @@ impl Display for TasksRelay {
}
let position = self.get_position_ref();
- let mut current = vec![];
- let mut roots = self.view.iter().flat_map(|id| self.get_by_id(id)).collect_vec();
+ let mut current: Vec<&Task>;
+ let roots = self.view.iter().flat_map(|id| self.get_by_id(id)).collect_vec();
if self.search_depth > 0 && roots.is_empty() {
current = self.resolve_tasks_rec(self.tasks.children_for(position), true, self.search_depth + self.view_depth);
if current.is_empty() {