Skip to content

Commit

Permalink
Sort Names Ignoring Case
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Dec 30, 2024
1 parent aaf189a commit 29b2cdd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum SortModes {
DISTANCE("nomilabs.gui.advanced_memory_card.sort.distance", wrapComp(SortModes::compareDistThenName)),
NAME("nomilabs.gui.advanced_memory_card.sort.name", wrapComp((a, b) -> {
if (a.getName().equals(b.getName())) return compareTypeThenDist(a, b, false);
return StringUtils.compare(a.getName(), b.getName());
return StringUtils.compareIgnoreCase(a.getName(), b.getName());
}));

private final String translationKey;
Expand Down Expand Up @@ -78,14 +78,14 @@ private static Comparator<InfoWrapper> compDefault(InfoWrapper selected) {
// Errors next, also sorted by frequency (display)
if (a.getError()) {
if (b.getError()) {
return StringUtils.compare(a.getFreqDisplay(), b.getFreqDisplay());
return StringUtils.compareIgnoreCase(a.getFreqDisplay(), b.getFreqDisplay());
}
return -1;
}
if (b.getError()) return 1;

// Else, sort by frequency (display)
return StringUtils.compare(a.getFreqDisplay(), b.getFreqDisplay());
return StringUtils.compareIgnoreCase(a.getFreqDisplay(), b.getFreqDisplay());
}

return compareTypeThenDist(a, b, true);
Expand All @@ -104,7 +104,7 @@ private static int compareDistThenName(InfoWrapper a, InfoWrapper b) {
double distA = getDistance(a);
double distB = getDistance(b);

if (distA == distB) return StringUtils.compare(a.getName(), b.getName());
if (distA == distB) return StringUtils.compareIgnoreCase(a.getName(), b.getName());
return Double.compare(distA, distB);
}

Expand Down

0 comments on commit 29b2cdd

Please sign in to comment.