diff options
Diffstat (limited to 'examples/live')
| -rw-r--r-- | examples/live/src/main.zig | 7 | ||||
| -rw-r--r-- | examples/live/test/live.script | 18 | ||||
| -rw-r--r-- | examples/live/test/story.script | 12 |
3 files changed, 21 insertions, 16 deletions
diff --git a/examples/live/src/main.zig b/examples/live/src/main.zig index 14058de..6e0f7e3 100644 --- a/examples/live/src/main.zig +++ b/examples/live/src/main.zig @@ -371,6 +371,8 @@ fn sound(s: *const State, ss: *Session, f: *sk.Frame) void { } const scale = 1.25; +/// The name a line defines is this much larger than the rest. +const step = 1.2; const margin = 16; const ink = 0xe8e8e8; const red = 0xff5a50; @@ -394,7 +396,10 @@ fn paragraph(a: std.mem.Allocator, ed: *const Editor, text: []const u8) sk.text. for (classes, 0..) |class, i| { if (i > 0 and classes[i - 1] == class) continue; const c = pe.syntax.synInk(theme, class) orelse base; - spans[n] = .{ .start = @intCast(i), .color = .{ .r = c[0], .g = c[1], .b = c[2] } }; + // the name a line defines, a step larger: the class the grammar's + // highlights give a definition's name node, and it alone + // (queries/highlights.scm) + spans[n] = .{ .start = @intCast(i), .color = .{ .r = c[0], .g = c[1], .b = c[2] }, .scale = if (class == .keyword) scale * step else null }; n += 1; } p.spans = spans; diff --git a/examples/live/test/live.script b/examples/live/test/live.script index 1ddcec2..0d4b0c2 100644 --- a/examples/live/test/live.script +++ b/examples/live/test/live.script @@ -81,17 +81,17 @@ 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 +# Drag a number: 220 (line 1, x 182 to 212: the code is laid out from 16, +# 10 pixels a character, the name `out` a step larger at 12, its line 26 +# high) 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 187 27 +move 207 27 +move 227 27 expect out.code[1].a 1130758144 -move 169 27 +move 175 27 expect out.code[1].a 1129906176 -up 169 27 +up 175 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 diff --git a/examples/live/test/story.script b/examples/live/test/story.script index 25e66f5..0849b28 100644 --- a/examples/live/test/story.script +++ b/examples/live/test/story.script @@ -16,13 +16,13 @@ frames 30 expect-audio 1 console save tone screenshot .zig-cache/story/1-tone.png -# 0:15 the pitch dragged, 220 to 330 (columns 16..18 of line 1; a step -# every 4 pixels: 245 on the way) -down 181 27 -move 281 27 +# 0:15 the pitch dragged, 220 to 330 (x 182 to 212 of line 1, after the +# larger `out`; a step every 4 pixels: 245 on the way) +down 187 27 +move 287 27 expect out.code[1].a 1131741184 -move 621 27 -up 621 27 +move 627 27 +up 627 27 expect out.code[1].a 1134886912 frames 10 screenshot .zig-cache/story/2-drag.png |
