Skip to content

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

:art: Improve find-replace of text containing escape characters https://github.com/siyuan-note/siyuan/issues/14173

Danielb6eea4b3977b
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 5afe09fcf8..4a012eba42 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -590,6 +590,12 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
if replaceTextNode(n, method, keyword, replacement, r, luteEngine) {
if nil != n.Parent && ast.NodeBackslash == n.Parent.Type {
unlinks = append(unlinks, n.Parent)
+
+ prev, next := n.Parent.Previous, n.Parent.Next
+ if nil != prev && ast.NodeText == prev.Type && nil != next && ast.NodeText == next.Type {
+ prev.Tokens = append(prev.Tokens, next.Tokens...)
+ unlinks = append(unlinks, next)
+ }
} else {
unlinks = append(unlinks, n)
}