Fixed regression that broke fuzzy matching for slash commands (#7859)

This addresses bug #7857 which was introduced recently as part of PR
#7704.
This commit is contained in:
Eric Traut
2025-12-10 22:42:45 -06:00
committed by GitHub
parent 3fc8b2894f
commit 057250020a
2 changed files with 31 additions and 4 deletions

View File

@@ -373,4 +373,23 @@ mod tests {
let description = rows.first().and_then(|row| row.description.as_deref());
assert_eq!(description, Some("send saved prompt"));
}
#[test]
fn fuzzy_filter_matches_subsequence_for_ac() {
let mut popup = CommandPopup::new(Vec::new(), false);
popup.on_composer_text_change("/ac".to_string());
let cmds: Vec<&str> = popup
.filtered_items()
.into_iter()
.filter_map(|item| match item {
CommandItem::Builtin(cmd) => Some(cmd.command()),
CommandItem::UserPrompt(_) => None,
})
.collect();
assert!(
cmds.contains(&"compact") && cmds.contains(&"feedback"),
"expected fuzzy search for '/ac' to include compact and feedback, got {cmds:?}"
);
}
}