mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
1 parent
3f797e656b
commit
91e5b57e24
43 files changed
+2018
-384
No files matched your search
+10
-5
@@ -152,10 +152,11 @@ func (e *Editor) editAnnotations(index int, ids []string, edit func([]byte, *edi
|
||||
}
|
||||
wanted := make(map[string]bool, len(ids))
|
||||
for _, id := range ids {
|
||||
if id == "" || wanted[id] {
|
||||
key := editorResourceID(id)
|
||||
if key == "" || wanted[key] {
|
||||
return fmt.Errorf("missing or duplicate annotation ID %q", id)
|
||||
}
|
||||
wanted[id] = true
|
||||
wanted[key] = true
|
||||
}
|
||||
if len(wanted) == 0 {
|
||||
return nil
|
||||
@@ -212,7 +213,7 @@ func (e *Editor) editAnnotations(index int, ids []string, edit func([]byte, *edi
|
||||
continue
|
||||
}
|
||||
count++
|
||||
id := node.attr("ID")
|
||||
id := editorResourceID(node.attr("ID"))
|
||||
if !wanted[id] {
|
||||
continue
|
||||
}
|
||||
@@ -262,7 +263,7 @@ func (e *Editor) editAnnotations(index int, ids []string, edit func([]byte, *edi
|
||||
parts[file] = editorPatchXML(content, changes)
|
||||
}
|
||||
for _, id := range ids {
|
||||
if !found[id] {
|
||||
if !found[editorResourceID(id)] {
|
||||
return fmt.Errorf("annotation %q not found", id)
|
||||
}
|
||||
}
|
||||
@@ -290,5 +291,9 @@ func (e *Editor) editAnnotations(index int, ids []string, edit func([]byte, *edi
|
||||
if len(parts) == 0 {
|
||||
return nil
|
||||
}
|
||||
return e.commitAnnotationParts(e.source, parts)
|
||||
base, err := e.annotationStructureSource(index, wanted)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.commitAnnotationParts(base, parts)
|
||||
}
|
||||
Reference in new issue
Block a user