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

This commit is contained in:
Daniel 2025-02-24 21:47:03 +08:00
parent 732e4ad329
commit b6eea4b397
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -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)
}