From 610ffe373f0f5dd5ccb59bf575f5479ad1ecdbaf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 07:57:28 -0300 Subject: examples/live: hear this, the expression a node walk leaves the selection on After Alt-o, Alt-i, Alt-n or Alt-p (helix's node walks, run in the editor on the module's parse) the primary range is read back and the text compiled again with it as a probe: Lang.compile takes the bytes of a selection and compiles the smallest expression holding them into a third tape, `Program.probe`. The compiler learns each expression's bytes as it parses (`spanned`: a number, a name used, a call, parentheses, a unary minus, each binary operation, a whole line), keeping the smallest that holds the probe: no table of spans. A name used is the line that defines it, so a walk onto `kick` hears kick. State keeps the probe's tape (`probe`, empty when there is none). While it is set, `draw` hears it as `out` (through the crossfade, as any change) and sees it as the picture, grey unless it is a colour. Any other key empties it, so Escape or an edit goes back to the program. It is in State, so a replay probes where the session did. Test: Lang.zig, a probe on an argument, a number, a cursor on one of its digits, a name used, a line's name, a selection Alt-o grew to, and between two lines (none); test/live.script, Alt-o twice from the 2 of 220 (`220`, then `tau * 220`), then Escape. Lang.compile takes the probe as a second argument; the other calls pass null. zig build test: 85 of 85 steps, 8 of 8 tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- examples/live/test/live.script | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'examples/live/test/live.script') diff --git a/examples/live/test/live.script b/examples/live/test/live.script index ecf3d77..a06ed97 100644 --- a/examples/live/test/live.script +++ b/examples/live/test/live.script @@ -68,3 +68,16 @@ 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 -- cgit v1.3