mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve doc tree Name Alphabet sorting https://github.com/siyuan-note/siyuan/issues/14773
This commit is contained in:
parent
949a57d42e
commit
0ef8783ce3
1 changed files with 3 additions and 3 deletions
|
|
@ -87,13 +87,13 @@ func PinYinCompare4FileTree(str1, str2 string) bool {
|
||||||
|
|
||||||
// 长度不相等的情况下,比较前面相等的部分
|
// 长度不相等的情况下,比较前面相等的部分
|
||||||
if len(a) < len(b) {
|
if len(a) < len(b) {
|
||||||
if 0 == bytes.Compare(a, b[:len(a)]) { // 前面相等的情况下,比较长度
|
if 0 == bytes.Compare(a, b[:len(a)]) { // 前面相等的情况下短的在前
|
||||||
return len(a) > len(b[:len(a)])
|
return true
|
||||||
}
|
}
|
||||||
return bytes.Compare(a, b[:len(a)]) < 0
|
return bytes.Compare(a, b[:len(a)]) < 0
|
||||||
}
|
}
|
||||||
if 0 == bytes.Compare(a[:len(b)], b) {
|
if 0 == bytes.Compare(a[:len(b)], b) {
|
||||||
return len(a[:len(b)]) > len(b)
|
return false
|
||||||
}
|
}
|
||||||
return bytes.Compare(a[:len(b)], b) < 0
|
return bytes.Compare(a[:len(b)], b) < 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue