From cff85b9a55c7d3f08de9ef9272b97d7fa6212302 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 5 Jul 2022 11:03:58 +0100 Subject: 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. --- src/string_vec.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/string_vec.h') 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 +#include #include +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")]] -- cgit v1.2.3