feat(性能优化): 优化全文搜索与字体匹配性能,修复EPS导出错误反馈
build.yaml / build (push) Successful in 36s

This commit is contained in:
xiaoqidun committed 2026-09-13 18:48:50 +08:00
1 parent a5c6ac8f03
commit 9bde9eec64
3 files changed
+40 -33

No files matched your search

+4 -1
View File
@@ -84,13 +84,16 @@ func (p *PageText) Search(query string) []TextMatch {
length := utf8.RuneCountInString(query)
for index, run := range p.Runs {
text := foldText(run.Text)
runes := []rune(run.Text)
var runes []rune
codeOffset := 0
for offset := 0; offset < len(text); {
found := strings.Index(text[offset:], query)
if found < 0 {
break
}
if runes == nil {
runes = []rune(run.Text)
}
start := codeOffset + utf8.RuneCountInString(text[offset:offset+found])
offset += found
end := start + length