浏览代码

Tweak string comparison to account for length (fixes #2831)

arkon 5 年之前
父节点
当前提交
d5350fd719
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt

+ 3 - 1
app/src/main/java/eu/kanade/tachiyomi/util/lang/StringExtensions.kt

@@ -30,7 +30,9 @@ fun String.truncateCenter(count: Int, replacement: String = "..."): String {
  * Case-insensitive natural comparator for strings.
  */
 fun String.compareToCaseInsensitiveNaturalOrder(other: String): Int {
-    return String.CASE_INSENSITIVE_ORDER.then(naturalOrder()).compare(this, other)
+    return compareBy<String> { it.length }
+        .then(String.CASE_INSENSITIVE_ORDER)
+        .then(naturalOrder()).compare(this, other)
 }
 
 /**