# requires: nofactory
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 J0KERPACK
# 1.18C33: the sequencers' edit journal never refuses a change. UNDO for big changes alone
# (CLEAR, a RECORD pass, DUPLICATE, an instrument ERASED): the pattern back to before the last one, the small edits
# made after it with it; small edits (a step tapped, a value turned) have none ("Undo NOTHING"). Full: the oldest undo
# levels given up; still full, the pattern edited is marked (its RAM copy its own until SAVE, "EDITS FULL" "NO UNDO
# SAVE"); 90 % full: "EDITS NEARLY FULL" "SAVE" once. A marked pattern left goes into one of the spare copies (two),
# else into the journal if it has room; else the strip asks ("PATTERN 3 UNSAVED" "REC SAVE  HOME DROP"): REC saves it
# (running: at the stop, the change not made), HOME drops its edits, PATTERN turned again: it stays. Running, the
# change waits for the line; a marked pattern left there goes into a spare copy, none free: the change not made, asked.
# Unsaved edits gone with the power, as before. Up to 1.18C32 a full journal refused every change ("EDITS FULL" "SAVE")
gl47
wait 1500
listen
autosave 0
tap SEQ
wait 300
viewis 10
sqis 1...1...1...1...
echo == a small edit: no undo
tapkey w1
wait 100
sqis 11..1...1...1...
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said Undo NOTHING
sqis 11..1...1...1...
jrlv a1 0 0
echo == DUPLICATE (a big change: an undo level), a small edit after it; UNDO: back to before DUPLICATE
tap EDIT
wait 200
turn SELECT 1
wait 200
tap REC
wait 300
said DUPLICATED
jrlv a1 1 0
tapkey w2
wait 100
sqis 111.1...1...1...
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said UNDO PATTERN
sqis 11..1...1...1...
jrlv a1 0 0
jrok
echo == CLEAR (one entry, an undo level), small edits after it; UNDO: back to before CLEAR
turn K4 1
wait 100
tap REC
wait 300
said Pattern 1 CLEARED
sqis ................
jrlv a1 1 0
tapkey w5
tapkey w6
wait 100
sqis .....11.........
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said UNDO CLEAR
sqis 11..1...1...1...
jrok
echo == a RECORD pass (one level, its notes and the edits after it); UNDO: back to before the pass
tap REC
wait 300
press PLAY
release PLAY
wait 200
key w8 down
wait 150
key w8 up
wait 300
key w11 down
wait 150
key w11 up
wait 500
press PLAY
release PLAY
wait 300
sqd
jrlv a1 1 0
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said UNDO PATTERN
sqis 11..1...1...1...
jrlv a1 0 0
jrok
echo == the drums: a hit, ERASE-like CLEAR, small edits, UNDO
tap SEQ
wait 300
viewis 11
tapkey b1
tapkey w2
wait 100
drstis 0 1 3 1
turn K4 1
wait 100
tap REC
wait 300
said Drums 1 CLEARED
drstis 0 1 3 0
tapkey w3
wait 100
drstis 0 1 4 1
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said UNDO CLEAR
drstis 0 1 3 1
drstis 0 1 4 0
jrlv d1 0 0
jrok
echo == 90 % full: EDITS NEARLY FULL once (after the change's own word; JR_N over 500 assumed here)
jrfill f-50
drpokes 30 3
wait 1500
said EDITS NEARLY FULL
drpokes 4 4
wait 1500
said_none
echo == full: CLEAR still done (one entry: the pattern's own entries make room; no undo then)
jrfill f+0
tap SEQ
wait 300
viewis 10
turn K4 1
wait 100
tap REC
wait 300
said CLEARED NO UNDO
sqis ................
jrlv a1 0 0
jrok
echo == full, a new byte: never refused; the pattern marked (its RAM copy), said once
tapkey w3
wait 100
sqis ...1............
jrlv a1 0 1
wait 1500
said EDITS FULL
tapkey w4
wait 100
sqis ...11...........
jrlv a1 0 1
jrhas a1 1
press OCT-
wait 600
tap HOME
wait 100
release OCT-
wait 300
said Undo NOTHING
sqis ...11...........
jrok
echo == stopped, another pattern: the marked one into a spare copy (no question); back: its edits there
turn K3 1
wait 300
pkis 0 2 -
sqis 1...1...1...1...
turn K3 -1
wait 300
pkis 0 1 -
sqis ...11...........
jrlv a1 0 1
echo == three marked patterns, the spare copies taken: the change waits, asked
turn K3 1
wait 300
jrfill f+0
tapkey w1
wait 100
jrlv a2 0 1
turn K3 1
wait 300
jrfill f+0
tapkey w2
wait 100
jrlv a3 0 1
turn K3 1
wait 300
pkis a3 3 -
sqis 1.1.1...1...1...
echo PATTERN turned again: taken back, it stays
turn K3 1
wait 300
pkis 0 3 -
echo again; HOME drops pattern 3's edits, then the change
turn K3 1
wait 300
pkis a3 3 -
tap HOME
wait 300
said PATTERN 3 DISCARDED
pkis 0 4 -
jrlv a3 0 0
jrhas a3 0
echo pattern 4 edited (marked), on to 5: asked, REC saves 4, then the change
jrfill f+0
tapkey w3
wait 100
jrlv a4 0 1
turn K3 1
wait 300
pkis a4 4 -
tap REC
wait 300
said PATTERN 4 SAVED
pkis 0 5 -
jrhas a4 0
turn K3 -1
wait 300
sqis 1..11...1...1...
jrok
echo pattern 3 as saved before (its edits dropped)
turn K3 -1
wait 300
sqis 1...1...1...1...
echo == running: a change at the line; the marked pattern left there asked about, REC: SAVE at the stop
turn K3 -2
wait 300
pkis 0 1 -
sqis ...11...........
turn K3 2
wait 300
jrfill f+0
tapkey w5
wait 100
jrlv a3 0 1
press PLAY
release PLAY
wait 300
turn K3 1
wait 2500
pkis a3 3 -
tap REC
wait 300
said SAVE PENDING
pkis 0 3 -
press PLAY
release PLAY
wait 300
said SAVED
jrhas a3 0
echo == SAVE on the page: every pattern with edits, the marked ones from their copies
tap SAVE
wait 200
tap REC
wait 300
said SAVED
jrn 0
pkis 0 3 -
turn K3 -2
wait 300
sqis ...11...........
echo == the power: unsaved edits gone, as before
tapkey w0
wait 100
sqis 1..11...........
edzero
reboot
wait 1500
tap SEQ
wait 300
viewis 10
sqis ...11...........
jrn 0
