summaryrefslogtreecommitdiff
path: root/src/desktop_vec.h
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2023-04-17 23:43:05 +0100
committerPhil Jones <philj56@gmail.com>2023-04-17 23:43:05 +0100
commit574eff0df1aff9bdc6d32939a03312cc08803de3 (patch)
tree5aeca72f70314bee3bf95db99f10d89f0a7b4032 /src/desktop_vec.h
parent71a4801d20d8904cfcfa5e92c96d53ee06a2c69f (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/desktop_vec.h')
-rw-r--r--src/desktop_vec.h3
1 files changed, 2 insertions, 1 deletions
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 <stddef.h>
#include <stdio.h>
#include <stdint.h>
+#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);