pub enum Move {
Cut(Cut),
JoinFolds(Vec<u32>),
LinkFoldState(Vec<u32>),
SetCollapsed((u32, bool)),
SetLabel((u32, Option<String>)),
SetTags((u32, Vec<String>)),
}Expand description
What a plugin asks for. A region is named by its id, or the file by
0 where a move allows it. Moves are carried out in order, and the next
plugin sees the result; a move that cannot be carried out aborts the
run with mutation_failed.
Fresh ids. When a plugin’s moves begin, the next fresh id is one above the largest region id in the file (both sides), and the next fresh alignment id one above the largest leaf alignment id. Moves take fresh ids in order, lhs side before rhs side:
- a
cuttakes the next alignment id, which the second pieces share, then gives the second piece on each side that holds the leaf (or its paired leaf) the next id, lhs first. Both second pieces take the lhs piece’s id (or the only piece’s) as their fold state id. The first piece keeps the leaf’s ids. - a
join-foldsgives the new fold on each side that holds the listed regions the next id, lhs first; both share the lhs fold’s id as their fold state id.
No other move takes an id. So a plugin that cuts a leaf with id l,
paired on the rhs, when the largest id is n, names the lhs second
piece n + 1 and the rhs one n + 2.
Variants§
Cut(Cut)
Split a leaf, and the leaf paired with it, at a line offset.
JoinFolds(Vec<u32>)
Wrap two or more consecutive siblings on each side that holds them in a new open, unlabelled fold without tags.
LinkFoldState(Vec<u32>)
Every region in the listed regions’ fold states takes the first region’s fold state id and collapsed state.
SetCollapsed((u32, bool))
Collapse or open every region sharing the region’s fold state, or hide or show the file (0).
SetLabel((u32, Option<String>))
Set or clear the label of one region, or of the file (0).
SetTags((u32, Vec<String>))
Replace one region’s tags. The file’s tags cannot be set here.