summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Applications/Assistant/FuzzyMatch.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Userland/Applications/Assistant/FuzzyMatch.cpp b/Userland/Applications/Assistant/FuzzyMatch.cpp
index e169847ba2..3453fb0634 100644
--- a/Userland/Applications/Assistant/FuzzyMatch.cpp
+++ b/Userland/Applications/Assistant/FuzzyMatch.cpp
@@ -37,24 +37,24 @@ static int calculate_score(String const& string, u8* index_points, size_t index_
for (size_t i = 0; i < index_points_size; i++) {
u8 current_idx = index_points[i];
- if (i > 0) {
- u8 previous_idx = index_points[i - 1];
- if (current_idx == previous_idx)
- out_score += SEQUENTIAL_BONUS;
- }
+ if (current_idx == 0)
+ out_score += FIRST_LETTER_BONUS;
- if (current_idx > 0) {
- u32 current_character = string[current_idx];
- u32 neighbor_character = string[current_idx - 1];
+ if (i == 0)
+ continue;
- if (neighbor_character != to_ascii_uppercase(neighbor_character) && current_character != to_ascii_lowercase(current_character))
- out_score += CAMEL_BONUS;
+ u8 previous_idx = index_points[i - 1];
+ if (current_idx == previous_idx)
+ out_score += SEQUENTIAL_BONUS;
- if (neighbor_character == '_' || neighbor_character == ' ')
- out_score += SEPARATOR_BONUS;
- } else {
- out_score += FIRST_LETTER_BONUS;
- }
+ u32 current_character = string[current_idx];
+ u32 neighbor_character = string[current_idx - 1];
+
+ if (neighbor_character != to_ascii_uppercase(neighbor_character) && current_character != to_ascii_lowercase(current_character))
+ out_score += CAMEL_BONUS;
+
+ if (neighbor_character == '_' || neighbor_character == ' ')
+ out_score += SEPARATOR_BONUS;
}
return out_score;