Skip to content

feat(core): a light show's shows, and the whole file, as operations that take themselves back - #824

Merged
mdwn merged 1 commit into
mainfrom
document-op
Nov 29, 2026
Merged

mdwn merged 1 commit into
mainfrom
document-op

Conversation

@mdwn

@mdwn mdwn commented Nov 29, 2026

Copy link
Copy Markdown
Owner

mtrack-core can now add and remove a show in a .light file and put the whole file, each as an undoable operation like the light show's other edits. The catalogue has 19 now.

Operations

  • light_show.insert_show { at, show, item } puts a show at place at among the file's shows.
    • item is where among the file's items it goes; the inverse of a removal gives it, so the show comes back between the items it was between.
    • Without one, a show goes after the show before it, or for the first, just before the show that was first. In a file with no shows, it goes last, where the writer puts one.
  • light_show.remove_show { show } takes a show out, its cues and comments with it.
  • light_show.set_document { document } puts the whole file as its text reads (an editor reads it by document(), against the file's own path, so includes resolve). Its inverse is the file as it was. It reports a new Moved::Everything, because any place may have moved, for whoever keeps names for them.
  • LightShow::named(name) (and edit::light_show::new_show) is a show with no cues, as an editor adds one.
  • The line placing that commands, references and effects shared (insert_lined, remove_lined, nth_line) is now generic over the kind of line, so a file's items use it too. Cue behaviour is unchanged; its tests pass as they were.

Not done here: the player keeps the last of two shows with one name (shows.insert by name), and checked doesn't refuse that. An editor adding a show is expected to refuse a name that's taken.

Tests

  • On every example: a show added first and last, every show taken out, and the file put whole, each taken back text for text.
  • a_show_taken_out_comes_back_between_the_items_it_was_between: a file with a sequence between two shows. The first show is taken out and put back, verbatim. A new show goes after the show before it, ahead of the sequence, and the file plays. The test fails if the item's place is ignored.
  • a_files_first_show_goes_last: a palette-only file gets its first show after the palette.
  • a_file_put_whole_is_taken_back_whole_and_says_everything_moved.
  • Refusals: a show out of range, and no such show.
  • Run: cargo test -p mtrack-core -p mtrack-rules-wasm (all pass), cargo fmt --check, make lint-rust (only the existing mvr_corpus warning), and make build-ui + make lint-ui.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEZZN4nU1eVZwV4ekT2St9

…hat take themselves back

insert_show and remove_show add a show and take one out, the removal's
inverse putting it back between the items it was between. set_document
puts the whole file, as its text reads, and says any place may have moved.

Claude-Session: https://claude.ai/code/session_01VEZZN4nU1eVZwV4ekT2St9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mdwn
mdwn merged commit ceefa74 into main Nov 29, 2026
24 checks passed
@mdwn
mdwn deleted the document-op branch November 29, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant