mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
Removing a track re-derived the permutation from (seed, size), so every remaining track moved to a new position and the queue visibly reshuffled (in an album-heavy playlist, the removed row and its neighbours were replaced by other tracks from the same album). Keep the permutation fixed over the domain it was created with and subtract removals from it instead: `ShuffleState` holds the seed, the domain size and the removed domain slots, kept in memory only. `flatContext`/`playContext` skip those slots so the surviving tracks keep their positions; the DB still stores just the seed and domain, so the old per-track `shuffle_order` rows stay gone. A new shuffle or a library change clears the removal list; on restart the removals are gone, so a queue that was edited falls back to unshuffled rather than guessing an order.