diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-05-10 23:13:47 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-05-10 23:13:47 +0200 |
| commit | f468b8089cc4ab1e76fac7ed8defb7dc6a65d6c7 (patch) | |
| tree | 5266c2cb6887f4fd166407f6b2df6abd1cbf08ad /src/common | |
| parent | 60969db9e072ea645d4076a58b4a6c5a55349288 (diff) | |
fix the linux bug with a workaround until the issue is resolved.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/fuzzy.odin | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/fuzzy.odin b/src/common/fuzzy.odin index cf4d82c..68223e0 100644 --- a/src/common/fuzzy.odin +++ b/src/common/fuzzy.odin @@ -148,20 +148,20 @@ fuzzy_to_acronym :: proc(word: string) -> (string, bool) { return str, true; } - -fuzzy_match :: proc(matcher: ^FuzzyMatcher, word: string) -> (f32, bool) { - +//changed from bool to int because of a linux bug - 10.05.2021 +fuzzy_match :: proc(matcher: ^FuzzyMatcher, word: string) -> (f32, int) { + if !fuzzy_init(matcher, word) { - return 0, false; + return 0, 0; } if matcher.pattern_count <= 0 { - return 1, true; + return 1, 1; } if acronym, ok := fuzzy_to_acronym(word); ok { if acronym == matcher.pattern { - return 20, true; + return 20, 1; } } @@ -171,7 +171,7 @@ fuzzy_match :: proc(matcher: ^FuzzyMatcher, word: string) -> (f32, bool) { cast(int)matcher.scores[matcher.pattern_count][matcher.word_count][match].score); if fuzzy_is_awful(best) { - return 0.0, false; + return 0.0, 0; } score := matcher.score_scale * min(perfect_bonus * cast(f32)matcher.pattern_count, cast(f32)max(0, best)); @@ -180,7 +180,7 @@ fuzzy_match :: proc(matcher: ^FuzzyMatcher, word: string) -> (f32, bool) { score *= 2; } - return score, true; + return score, 1; } fuzzy_is_awful :: proc(s: int) -> bool { |