aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-03-19 21:49:15 +0100
committerDanielGavin <danielgavin5@hotmail.com>2024-03-19 21:49:15 +0100
commit0d2b51eab4892f440db28657bc7b25c41d9cd640 (patch)
tree7f8cc4aa68a5bbca282577a078d542c0e07cce36
parent1e228970051db304de58ec0dfcabf4ec9541a725 (diff)
Support longer words in fuzzy and return 0, if above that.
-rw-r--r--src/common/fuzzy.odin7
1 files changed, 4 insertions, 3 deletions
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