From ae525c870ff04d2c6bd33de7b2419b42a1b9cef9 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 9 Nov 2024 19:36:06 +0100 Subject: [PATCH] fix: filter from correct position with multiple slashes --- src/main.rs | 2 +- src/tasks.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) 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 (&self, position: Option<&EventId>, predicate: P) -> Vec