Add region lookup and structural edits, and reject regions Build can't write

Instrument.Source returns the flattened region and header behind a typed
region. AddRegion, RemoveRegion and MoveRegion edit the document and read
the instrument again, restoring the document if a region would read
differently. NewRegion returns a region with the format's defaults, and
Build refuses a region that can't be read back as it is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 01:19:40 +00:00
co-authored by Claude Sonnet 5.5
parent 535856ba77
commit 49fd867283
8 changed files with 571 additions and 5 deletions
+3
View File
@@ -228,6 +228,9 @@ type Instrument struct {
sources []FlatRegion
// eval reads a region from opcodes, as when the regions were read.
eval evaluator
// doc is the document the instrument was read from, or nil if it wasn't read
// from one.
doc *Document
}
// The keys of [Instrument.Skipped], the reasons that a region has no typed