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/string_vec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/string_vec.h') diff --git a/src/string_vec.h b/src/string_vec.h index 6f54d56..4d77ad3 100644 --- a/src/string_vec.h +++ b/src/string_vec.h @@ -6,6 +6,7 @@ #include #include #include "history.h" +#include "matching.h" struct scored_string { char *string; @@ -73,7 +74,7 @@ struct scored_string_ref *string_ref_vec_find_sorted(struct string_ref_vec *rest struct string_ref_vec string_ref_vec_filter( const struct string_ref_vec *restrict vec, const char *restrict substr, - bool fuzzy); + enum matching_algorithm algorithm); [[nodiscard("memory leaked")]] struct string_ref_vec string_ref_vec_from_buffer(char *buffer); -- cgit v1.2.3