diff options
author | kotontrion <[email protected]> | 2025-01-08 11:52:45 +0100 |
---|---|---|
committer | kotontrion <[email protected]> | 2025-01-08 11:52:45 +0100 |
commit | c5b219171cbab489b01087a372e24e3a719f6299 (patch) | |
tree | bb5b6601cef4e60f02714d0c3fdc570b4bc4e922 | |
parent | fa2d55e2c2ff2ba9e059f774db60aa4709292266 (diff) |
apps: fix wrong penalty
-rw-r--r-- | lib/apps/fuzzy.vala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/apps/fuzzy.vala b/lib/apps/fuzzy.vala index 7745320..590112e 100644 --- a/lib/apps/fuzzy.vala +++ b/lib/apps/fuzzy.vala @@ -2,15 +2,15 @@ namespace AstalApps { private int fuzzy_match_string(string pattern, string str) { const int unmatched_letter_penalty = -1; int score = 100; + int not_found_score = -10; if (pattern.length == 0) return score; - if (str.length < pattern.length) return int.MIN; + if (str.length < pattern.length) return not_found_score; bool found = fuzzy_match_recurse(pattern, str, score, true, out score); score += unmatched_letter_penalty * (str.length - pattern.length); - if(!found) score = -10; - + if(!found) score = not_found_score; return score; } |