# A program typed through the editor (helix's keys: `i`, text, Escape, # motions), its tapes after each line, a broken line and its mend (an # undo); then this run's session played back, and sought to two moments # marked as they happened. (A mark ends a clip, `record`, so the session is # replayed.) # Screenshots land in .zig-cache/live/ for review; they are compared over # the picture alone (640,300 600x300: not the text, the scope or the time). frames 2 type i type out = sin(tau * 220 * t) * 0.3 expect problem.len 0 expect out.len 8 expect out.code[5].op sin expect out.code[7].op mul # The GPU's blocks reach the speakers' stream (SDL's dummy driver here). frames 10 expect-audio 1 key return type color = hsv(x, 0.5, y) expect color.len 4 expect color.code[0].op x expect color.code[3].op hsv key escape expect ed.cursor.mode normal frames 2 console save typed screenshot .zig-cache/live/gradient.png # An edit: y becomes x (to the line's end, a character left, replaced), # and the picture changes. type gl type h type rx expect color.len 3 expect color.code[2].op hsv expect color.code[2].c 0 frames 2 screenshot .zig-cache/live/edited.png expect-different-screenshot .zig-cache/live/gradient.png .zig-cache/live/edited.png 640 300 600 300 # Broken: the ) deleted; the tape and the picture stay, the problem is set # at its byte. type l type d expect problem.at 52 expect color.len 3 expect color.code[2].c 0 frames 2 screenshot .zig-cache/live/broken.png expect-same-screenshot .zig-cache/live/edited.png .zig-cache/live/broken.png 0 640 300 600 300 # Mended: undone. type u expect problem.len 0 expect color.len 3 console save end # Played back from the start, then sought: each moment's text, tapes and # time as they were live, leaf by leaf (a mark is taken before its frame's # tick: 0.3 s and 0.5333 s; a seek lands on the last frame at or before). console play session 0 frames 100 console seek 538 expect-snapshot end console seek 305 expect-snapshot typed expect color.len 4 screenshot .zig-cache/live/sought.png expect-same-screenshot .zig-cache/live/gradient.png .zig-cache/live/sought.png 0 0 0 1000 600 # Live again from there: the typed program, before its edit. console stop expect ed.front 53 expect ed.back 0 expect color.code[3].op hsv # Hear this: Alt-o from the 2 of 220 to the number, then to `tau * 220`, # which alone is heard and seen until the next key. type gg type 16l hold left_alt key o expect probe.len 1 key o release left_alt expect probe.len 3 expect probe.code[2].op mul key escape expect probe.len 0 # Drag a number: 220 (line 1, columns 16..18; a column 10 pixels from 16, # a line 22 from 16) pressed and dragged 40 pixels right is 230, then 12 # left of where it was pressed is 217; the program follows; the drag is one # step to undo. down 181 27 move 201 27 move 221 27 expect out.code[1].a 1130758144 move 169 27 expect out.code[1].a 1129906176 up 169 27 type u expect out.code[1].a 1130102784 # Square units: a disc of radius 0.5 (half the window's height is 1) is # 180 pixels across each way from the centre, round on 16:9. type % type c type color = step(x * x + y * y, 0.25) key escape expect color.len 7 frames 2 screenshot .zig-cache/live/disc.png expect-pixel .zig-cache/live/disc.png 810 360 255 255 255 255 2 expect-pixel .zig-cache/live/disc.png 640 190 255 255 255 255 2 expect-pixel .zig-cache/live/disc.png 470 360 255 255 255 255 2 expect-pixel .zig-cache/live/disc.png 830 360 0 0 0 255 2 expect-pixel .zig-cache/live/disc.png 640 170 0 0 0 255 2 expect-pixel .zig-cache/live/disc.png 640 550 0 0 0 255 2