From 02ee174fea173d28abf66b5e45b875b15417f45b Mon Sep 17 00:00:00 2001 From: multiplex55 <6619098+multiplex55@users.noreply.github.com> Date: Sun, 1 Feb 2026 19:17:38 -0500 Subject: [PATCH 1/2] Adjust todo search results --- src/plugins/todo.rs | 10 +++++++++- tests/todo_plugin.rs | 36 +++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/plugins/todo.rs b/src/plugins/todo.rs index 195337c9..333c94bd 100644 --- a/src/plugins/todo.rs +++ b/src/plugins/todo.rs @@ -217,6 +217,14 @@ impl TodoPlugin { fn search_internal(&self, trimmed: &str) -> Vec { if let Some(rest) = crate::common::strip_prefix_ci(trimmed, "todo") { + if rest.is_empty() { + return vec![Action { + label: "todo: edit todos".into(), + desc: "Todo".into(), + action: "todo:dialog".into(), + args: None, + }]; + } if rest.trim().is_empty() { let mut actions = vec![Action { label: "todo: edit todos".into(), @@ -604,7 +612,7 @@ impl Default for TodoPlugin { impl Plugin for TodoPlugin { fn search(&self, query: &str) -> Vec { - let trimmed = query.trim(); + let trimmed = query.trim_start(); let key = trimmed.to_string(); if let Ok(mut cache) = self.cache.write() { if let Some(res) = cache.get(&key).cloned() { diff --git a/tests/todo_plugin.rs b/tests/todo_plugin.rs index 3425ea44..0e6e9ea2 100644 --- a/tests/todo_plugin.rs +++ b/tests/todo_plugin.rs @@ -117,24 +117,26 @@ fn search_plain_todo_opens_dialog() { let _lock = TEST_MUTEX.lock().unwrap(); let plugin = TodoPlugin::default(); let results = plugin.search("todo"); + assert_eq!(results.len(), 1); + assert_eq!(results[0].action, "todo:dialog"); +} + +#[test] +fn search_todo_space_shows_submenu() { + let _lock = TEST_MUTEX.lock().unwrap(); + let plugin = TodoPlugin::default(); + let results = plugin.search("todo "); let labels: Vec<&str> = results.iter().map(|action| action.label.as_str()).collect(); - let actions: Vec<&str> = results.iter().map(|action| action.action.as_str()).collect(); - assert_eq!( - labels, - vec![ - "todo: edit todos", - "todo edit", - "todo list", - "todo tag", - "todo view", - "todo add", - "todo rm", - "todo clear", - "todo pset", - "todo export", - ] - ); - assert_eq!(actions[0], "todo:dialog"); + assert!(labels.contains(&"todo: edit todos")); + assert!(labels.contains(&"todo edit")); + assert!(labels.contains(&"todo list")); + assert!(labels.contains(&"todo tag")); + assert!(labels.contains(&"todo view")); + assert!(labels.contains(&"todo add")); + assert!(labels.contains(&"todo rm")); + assert!(labels.contains(&"todo clear")); + assert!(labels.contains(&"todo pset")); + assert!(labels.contains(&"todo export")); } #[test] From 3ed383f7ec81d4c885a5d67e99a8281f79a23a33 Mon Sep 17 00:00:00 2001 From: multiplex55 <6619098+multiplex55@users.noreply.github.com> Date: Sun, 1 Feb 2026 19:22:22 -0500 Subject: [PATCH 2/2] Update todo root query test --- src/plugins/todo.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/todo.rs b/src/plugins/todo.rs index 333c94bd..ae37266d 100644 --- a/src/plugins/todo.rs +++ b/src/plugins/todo.rs @@ -861,7 +861,7 @@ mod tests { } #[test] - fn todo_root_query_lists_subcommands_in_order() { + fn todo_root_query_with_space_lists_subcommands_in_order() { let plugin = TodoPlugin { matcher: SkimMatcherV2::default(), data: TODO_DATA.clone(), @@ -869,7 +869,7 @@ mod tests { watcher: None, }; - let actions = plugin.search_internal("todo"); + let actions = plugin.search_internal("todo "); let labels: Vec<&str> = actions.iter().map(|a| a.label.as_str()).collect(); let actions_list: Vec<&str> = actions.iter().map(|a| a.action.as_str()).collect();