Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve av sorting https://github.com/siyuan-note/siyuan/issues/12720

Daniel94bcc359ff59
diff --git a/kernel/av/sort.go b/kernel/av/sort.go
index a2505cd598..4002bc7e8d 100644
--- a/kernel/av/sort.go
+++ b/kernel/av/sort.go
@@ -44,6 +44,10 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
switch value.Type {
case KeyTypeBlock:
if nil != value.Block && nil != other.Block {
+ if 0 == strings.Compare(value.Block.Content, other.Block.Content) {
+ return 0
+ }
+
if util.PinYinCompare(value.Block.Content, other.Block.Content) {
return -1
}
@@ -59,6 +63,11 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
} else if "" == other.Text.Content {
return -1
}
+
+ if 0 == strings.Compare(value.Text.Content, other.Text.Content) {
+ return 0
+ }
+
if util.PinYinCompare(value.Text.Content, other.Text.Content) {
return -1
}
@@ -229,6 +238,11 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
for _, v := range other.MAsset {
v2 += v.Content
}
+
+ if 0 == strings.Compare(v1, v2) {
+ return 0
+ }
+
if util.PinYinCompare(v1, v2) {
return -1
}
@@ -247,6 +261,11 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
}
return 0
}
+
+ if 0 == strings.Compare(value.Template.Content, other.Template.Content) {
+ return 0
+ }
+
if util.PinYinCompare(value.Template.Content, other.Template.Content) {
return -1
}
@@ -290,6 +309,11 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
oContentBuf.WriteByte(' ')
}
oContent := strings.TrimSpace(oContentBuf.String())
+
+ if 0 == strings.Compare(vContent, oContent) {
+ return 0
+ }
+
if util.PinYinCompare(vContent, oContent) {
return -1
}
@@ -323,6 +347,11 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
oContentBuf.WriteByte(' ')
}
oContent := strings.TrimSpace(oContentBuf.String())
+
+ if 0 == strings.Compare(vContent, oContent) {
+ return 0
+ }
+
if util.PinYinCompare(vContent, oContent) {
return -1
}