From 574eff0df1aff9bdc6d32939a03312cc08803de3 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Mon, 17 Apr 2023 23:43:05 +0100 Subject: Add --matching-algorithm option. This replaces the --fuzzy-match algorithm. Available choices are normal, prefix and fuzzy. Levenshtein distance was investigated, but it seems pretty rubbish for tofi's use case, where you normally want a good match when you've only typed a small portion of the target string. --- src/desktop_vec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/desktop_vec.h') diff --git a/src/desktop_vec.h b/src/desktop_vec.h index f8d0b79..cdc0d6c 100644 --- a/src/desktop_vec.h +++ b/src/desktop_vec.h @@ -5,6 +5,7 @@ #include #include #include +#include "matching.h" struct desktop_entry { char *id; @@ -37,7 +38,7 @@ struct desktop_entry *desktop_vec_find_sorted(struct desktop_vec *restrict vec, struct string_ref_vec desktop_vec_filter( const struct desktop_vec *restrict vec, const char *restrict substr, - bool fuzzy); + enum matching_algorithm algorithm); struct desktop_vec desktop_vec_load(FILE *file); void desktop_vec_save(struct desktop_vec *restrict vec, FILE *restrict file); -- cgit v1.2.3