diff options
author | Phil Jones <philj56@gmail.com> | 2023-04-17 23:43:05 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2023-04-17 23:43:05 +0100 |
commit | 574eff0df1aff9bdc6d32939a03312cc08803de3 (patch) | |
tree | 5aeca72f70314bee3bf95db99f10d89f0a7b4032 /src/string_vec.h | |
parent | 71a4801d20d8904cfcfa5e92c96d53ee06a2c69f (diff) |
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.
Diffstat (limited to 'src/string_vec.h')
-rw-r--r-- | src/string_vec.h | 3 |
1 files changed, 2 insertions, 1 deletions
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 <stdint.h> #include <stdio.h> #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); |