diff options
author | Phil Jones <philj56@gmail.com> | 2022-07-05 11:03:58 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2022-07-05 11:03:58 +0100 |
commit | cff85b9a55c7d3f08de9ef9272b97d7fa6212302 (patch) | |
tree | 5d0d9b147ec2f2ec63a86f0e26fceee9e03c8452 /src/string_vec.h | |
parent | e062dc7ca2bb70561b11674428939057832158a9 (diff) |
Sort results by match position.
Search results will now be sorted by history first, then by the position
of the match, such that a match at the start of a result will appear
before a match later in the result.
Diffstat (limited to 'src/string_vec.h')
-rw-r--r-- | src/string_vec.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/string_vec.h b/src/string_vec.h index 44fd5fe..2a106a2 100644 --- a/src/string_vec.h +++ b/src/string_vec.h @@ -2,12 +2,19 @@ #define STRING_VEC_H #include <stddef.h> +#include <stdint.h> #include <stdio.h> +struct scored_string { + char *string; + int8_t search_score; + int8_t history_score; +}; + struct string_vec { size_t count; size_t size; - char **buf; + struct scored_string *buf; }; [[nodiscard("memory leaked")]] |