Skip to content

Commit

Permalink
Merge pull request #17 from danc86/sort-name-ascending
Browse files Browse the repository at this point in the history
sort suggestions by name ascending
  • Loading branch information
PonasKovas committed Jun 29, 2023
2 parents 8e3d22f + 8fdd488 commit a31f01c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main.rs
Expand Up @@ -227,9 +227,8 @@ fn update_suggestions(
state.suggestions.push((mtch, name.to_string()));
}
}
// sort the suggestion by match scores
state.suggestions.sort_unstable();
state.suggestions.reverse();
// sort the suggestion by match scores (descending) and name (ascending)
state.suggestions.sort_unstable_by(|a, b| b.0.cmp(&a.0).then(a.1.cmp(&b.1)));

for (i, suggestion) in state.suggestions.iter().enumerate() {
let name = &suggestion.1;
Expand Down

0 comments on commit a31f01c

Please sign in to comment.