From 0d2b51eab4892f440db28657bc7b25c41d9cd640 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Tue, 19 Mar 2024 21:49:15 +0100 Subject: Support longer words in fuzzy and return 0, if above that. --- src/common/fuzzy.odin | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/fuzzy.odin b/src/common/fuzzy.odin index c425051..822f37f 100644 --- a/src/common/fuzzy.odin +++ b/src/common/fuzzy.odin @@ -8,7 +8,7 @@ import "core:fmt" */ max_pattern :: 63 -max_word :: 127 +max_word :: 256 awful_score: int = -(1 << 13) perfect_bonus :: 4 @@ -189,8 +189,9 @@ fuzzy_is_awful :: proc(s: int) -> bool { } fuzzy_calculate_roles :: proc(text: string, roles: ^[]FuzzyCharRole) -> FuzzyCharTypeSet { - - assert(len(text) == len(roles)) + if len(text) != len(roles) { + return 0 + } if len(text) == 0 { return 0 -- cgit v1.2.3