1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
//! `nodes`, a lens (design/README.md, "3. Panels"): the structs the
//! program's pointers reach from a root variable (`objects.reach`: the
//! recording's types say which fields are pointers and which is the
//! value), drawn as boxes of a value and a pointer with arrows between
//! them, in the band's left half; and in its right half the `hexdump` of
//! the bytes they are drawn from. A node's place is its allocation's, so
//! nodes stay where they are while pointers change: a list reversing is
//! its arrows turning round. Above each node its address, the same digits
//! as its row in the dump; under it its `pin`: the registers, and the
//! scene's variables, that hold its address. This is the idea drawn from
//! memory: it reacts when the step's projection arrives from its bytes.
//! Reads `Moment.variables`, `Moment.read`, `Moment.allocation`.
const std = @import("std");
const sk = @import("sketch");
const anim = @import("anim");
const zt = @import("ztrace");
const ui = @import("ui.zig");
const rows = @import("rows.zig");
const context = @import("context.zig");
const cursors = @import("cursor.zig");
const Recording = @import("Recording.zig");
const objects = @import("objects.zig");
const hexdump = @import("hexdump.zig");
const ties = @import("ties.zig");
const Stage = @import("stage.zig").Stage;
const theme = ui.theme;
const time = theme.time;
const Rect = ui.Rect;
const t = theme.color.text;
const m = theme.metric.context;
pub const Nodes = struct {
cursor: cursors.Cursor,
stage: *const Stage,
title: []const u8 = "the list",
/// The variable the structure hangs from.
root: []const u8,
/// The scene's variables that point at nodes, named in their pins with the registers.
track: []const []const u8 = &.{},
/// No registers in the pins: an instrumented program's registers say nothing of it.
quiet: bool = false,
focus: bool = true,
pub fn draw(g: *const Nodes, f: *sk.Frame, placed: anim.Placed) void {
const box = g.stage.box(placed, .band);
if (box.h < m.tag + m.row) return;
const u = context.at(f, placed, box).faded(placed.value(g.stage.drawing));
// A relayout moves the band: what is drawn in it stays inside it
// (its view, drawn below, clips itself and hands the clip back).
u.clip(.{ .x = 0, .y = 0, .w = box.w, .h = box.h });
defer u.unclip();
const now = g.cursor.now(placed);
const rec = g.cursor.rec;
const heap = theme.color.region.heap;
const legend = [_]ui.Legend{
.{ .text = "value", .ink = ui.rgb(t.primary) },
.{ .text = "next", .ink = ui.rgb(heap) },
.{ .text = "malloc's", .ink = ui.rgb(t.dim) },
.{ .text = "never read", .ink = ui.rgb(t.faint) },
};
_ = u.panel(box.w, box.h, g.title, .{ .focus = g.focus });
const moment = now.shown(.idea);
const things = objects.reach(f.scratch, rec, moment, null);
const before = objects.reach(f.scratch, rec, now.before(), null);
// Its view: the heap the nodes are in, from the first one's chunk to the last's.
var lo: u64 = std.math.maxInt(u64);
var hi: u64 = 0;
for (rec.allocations) |a| if (things.len > 0 and a.size == things[0].type.record.size) {
lo = @min(lo, (a.ptr - 16) & ~@as(u64, 15));
hi = @max(hi, (a.ptr + a.size + 15) & ~@as(u64, 15));
};
if (lo < hi) {
@import("map.zig").measure(.view, (hi - lo) / 16);
const count = theme.layout.rowsIn(g.stage.box(placed, .view).h);
const first = hexdump.window(now, lo, hi, count);
const shown = @min(count, (hi - first) / 16);
const v = hexdump.panel(f, placed, g.stage, u.print("the heap, {x} to {x}", .{ first, first + 16 * shown - 1 }), &legend);
if (v.rows > 0) hexdump.draw(v.u, now, 0, m.tag + m.pad, first, @min(shown, v.rows), .{ .things = things });
if (v.rows > 0) @import("map.zig").window(.view, .{ first, first + 16 * (@min(shown, v.rows) -| 1) }, .{ first, first + 16 * (@min(shown, v.rows) -| 1) }, 1);
v.veil(now);
u.clip(.{ .x = 0, .y = 0, .w = box.w, .h = box.h });
}
if (things.len == 0) {
const root = rec.variable(f.scratch, moment, g.root);
const empty = root != null and (Recording.word(moment, root.?.addr, 8) catch null) == 0;
u.text(.sans, theme.size.sans.micro, 24, m.tag + 40, if (empty) u.print("empty: {s} is NULL", .{g.root}) else "nothing yet", t.faint);
return;
}
// The drawing: one place for every node the program will ever make,
// so none moves when another comes or goes.
const subject = box.h >= theme.layout.split.subject.band.h - 1;
const size = if (subject) theme.metric.node.subject else theme.metric.node.beside;
const label: f32 = if (subject) theme.size.mono.small else theme.size.mono.context;
const value_size: f32 = if (subject) theme.size.mono.flight else theme.size.mono.small;
var slots: usize = 0;
for (rec.allocations) |a| slots += @intFromBool(a.size == things[0].type.record.size);
slots = @max(slots, 1);
const n: f32 = @floatFromInt(slots);
const x0 = (box.w - n * size[0] - (n - 1) * size[2]) / 2;
const ly = m.tag + @as(f32, if (subject) 72 else 16);
const ny = ly + label * 1.2 + 4;
const places = f.scratch.alloc(Rect, things.len) catch return;
for (things, places, 0..) |o, *place, i| {
place.* = .{ .x = x0 + @as(f32, @floatFromInt(o.slot orelse i)) * (size[0] + size[2]), .y = ny, .w = size[0], .h = size[1] };
ties.anchor(u, .{ .node = o.addr }, place.*);
}
// Each node as much as it has risen from its bytes (`establish`): by address.
const rising = placed.value(g.stage.rise);
const shows = f.scratch.alloc(f32, things.len) catch return;
const belows = f.scratch.alloc(f32, things.len) catch return;
for (things, shows, belows) |o, *show, *below| {
var k: usize = 0;
for (things) |other| k += @intFromBool(other.addr < o.addr);
const r = ties.rise(rising, k, things.len);
show.* = r.element;
below.* = r.below;
}
// Arrows first, under the nodes' edges.
const since = now.since(.idea, 0);
const whole = u;
for (things, places, shows) |o, place, show| for (o.type.record.fields) |field| {
if (field.type != .pointer) continue;
const from_addr = o.addr + field.offset;
const start = ui.Vec{ place.x + place.w - theme.metric.node.pointer_w / 2 + 6, place.y + place.h / 2 };
const new = if (Recording.word(now.moment(), from_addr, 8) catch null) |target| placeOf(things, places, target) else null;
const old = if (Recording.word(now.before(), from_addr, 8) catch null) |target| placeOf(things, places, target) else null;
// An arrow is there once both its ends are.
var reach = show;
if (Recording.word(now.moment(), from_addr, 8) catch null) |target| for (things, shows) |other, other_show| {
if (other.addr == target) reach = @min(reach, other_show);
};
if (reach <= 0) continue;
const v = if (reach < 1) whole.faded(reach) else whole;
const fresh = now.writeAge(from_addr, 8) == 0;
const ink = ui.rgb(heap);
const head = theme.metric.node.arrow_head;
if (!fresh or !now.walking()) {
if (if (now.landed(.idea, 0)) new else old) |to| v.route(route(v, start, place, to), ink, .{ .width = theme.stroke.line, .head = head, .progress = if (fresh) cursors.standard(now.moving(.idea, 0, time.redirect.head)) else 1 });
continue;
}
// A pointer rewritten. Anticipation: as its half is armed the
// old arrow goes dashed and faint. Then the half strikes, the
// new arrow grows to the node it now points at, and that node
// answers with a bright frame. The old one lingers, then goes.
const armed = since >= -time.strike.arm;
if (old) |to| {
const ghost = if (armed) v.faded(1 - std.math.clamp((since - time.redirect.ghost_hold) / time.redirect.ghost_out, 0, 1)) else v;
ghost.route(route(v, start, place, to), if (armed) ui.rgb(t.faint) else ink, .{ .dashed = armed, .head = if (armed) null else head, .width = if (armed) theme.stroke.rule else theme.stroke.line });
}
if (new) |to| {
v.route(route(v, start, place, to), ink, .{ .width = theme.stroke.line, .head = head, .progress = cursors.standard(std.math.clamp((since - time.snap) / time.redirect.head, 0, 1)) });
const landed = since - time.snap - time.redirect.head;
const out = 4;
if (landed >= 0 and landed < time.redirect.landing) v.faded(1 - landed / time.redirect.landing).frame(.{ .x = to.x - out, .y = to.y - out, .w = to.w + 2 * out, .h = to.h + 2 * out }, theme.mark(.attention).solid, theme.stroke.rule);
}
};
for (things, places, shows, belows) |o, place, show, below| {
const new = for (before) |was| {
if (was.addr == o.addr) break false;
} else true;
// What begins fades in; it does not pop.
if (show > 0) g.node(u.faded(show * (if (new) now.moving(.idea, 0, time.quick) else 1)).moved(0, below), now, o, place, label, value_size);
}
g.tags(u, now, things, places, label);
}
fn node(g: *const Nodes, u: ui.Ui, now: cursors.Now, o: objects.Object, r: Rect, label: f32, value_size: f32) void {
const moment = now.shown(.idea);
const heap = theme.color.region.heap;
const pw = theme.metric.node.pointer_w;
const value: Rect = .{ .x = r.x, .y = r.y, .w = r.w - pw - 2, .h = r.h };
const pointer: Rect = .{ .x = r.x + r.w - pw, .y = r.y, .w = pw, .h = r.h };
// Its address over it, in heap's ink: the digits of its row in the dump.
const digits = u.print("{x}", .{o.addr});
const lw = @as(f32, @floatFromInt(digits.len)) * label * 3 / 5;
const ly = r.y - 4 - label * 1.2;
u.text(.mono, label, r.x + (r.w - lw) / 2, ly + label * 0.96, digits, heap);
ties.anchor(u, .{ .node_address = o.addr }, .{ .x = r.x, .y = ly, .w = r.w, .h = label * 1.2 });
if (o.freed) {
// Handed back: its bytes are still there, and nobody owns them.
u.dashedFrame(r, theme.mark(.freed).solid, theme.stroke.line);
} else {
u.fill(value, theme.color.raised);
u.fill(pointer, theme.color.well);
}
if (o.valueField()) |field| {
const bytes: usize = @intCast(@min(8, field.type.size() orelse 8));
const at = o.addr + field.offset;
ties.anchor(u, .{ .node_part = at }, value);
var ink: ui.Ink = .{};
if (!o.freed) ink = u.cellWritten(value, now.written(at, bytes, .idea, 0), theme.color.raised);
if (now.wasRead(at, bytes) and now.writeAge(at, bytes) != 0) u.cellRead(value, now.reading(.idea, 0));
if (Recording.word(moment, at, bytes) catch null) |n| {
const shift: u6 = @intCast(64 - 8 * bytes);
const signed = @as(i64, @bitCast(n << shift)) >> shift;
u.label(ink.face, value_size, value, .center, objects.reading(u.f.scratch, signed, field.type), if (o.freed) ui.rgb(t.faint) else ink.ink);
} else u.unknown(value);
}
// The first pointer field: the square its arrow leaves from, or a slash for null.
for (o.type.record.fields) |field| {
if (field.type != .pointer) continue;
const at = o.addr + field.offset;
ties.anchor(u, .{ .node_part = at }, pointer);
const held = Recording.word(moment, at, 8) catch null;
const struck = !o.freed and u.cellWritten(pointer, now.written(at, 8, .idea, 0), theme.color.well).face == .mono_bold;
if (now.wasRead(at, 8) and now.writeAge(at, 8) != 0) u.cellRead(pointer, now.reading(.idea, 0));
const sq = theme.metric.node.origin;
if (held == null) {
u.unknown(pointer);
} else if (held.? == 0) {
u.line(.{ pointer.x + 10, pointer.y + pointer.h - 8 }, .{ pointer.x + pointer.w - 10, pointer.y + 8 }, if (struck) t.ink else t.dim, theme.stroke.rule);
} else u.fill(.{ .x = pointer.x + pointer.w / 2 - sq / 2, .y = pointer.y + pointer.h / 2 - sq / 2, .w = sq, .h = sq }, if (struck) t.ink else heap);
break;
}
// Who points here: a pin under it, landing with its link.
const names = g.pins(u, now, o.addr);
const cx = r.x + r.w / 2;
ties.anchor(u, .{ .node_pin = o.addr }, .{ .x = cx - 1, .y = r.y + r.h, .w = 2, .h = label + 10 });
if (names.names.len > 0 and names.shows > 0) {
u.faded(names.shows).pinUnderInked(cx, r.y + r.h, &.{}, &.{}, heap, label);
u.faded(names.shows * names.text).pinNames(cx, r.y + r.h, names.names, names.inks, label);
}
}
/// Where variable `name`'s tag is: it travels from node to node in the
/// drawing's slot, as the idea strikes, after its word has been struck
/// (`glide`, `time.pin`: 30 f to the next node, 36 f further); it does not jump.
fn tagOf(g: *const Nodes, u: ui.Ui, now: cursors.Now, name: []const u8) Tag {
const rec = g.cursor.rec;
const at = struct {
fn value(r: *Recording, scratch: std.mem.Allocator, then: Recording.Moment, n: []const u8) u64 {
const v = r.variable(scratch, then, n) orelse return 0;
if (!r.assigned(v, then.index)) return 0;
return (Recording.word(then, v.addr, 8) catch null) orelse 0;
}
};
const to = at.value(rec, u.f.scratch, now.moment(), name);
const from = at.value(rec, u.f.scratch, now.before(), name);
if (from == to or now.resting()) return .{ .from = from, .to = to, .p = 1 };
const far: f32 = if (from != 0 and to != 0 and @abs(@as(i64, @bitCast(to -% from))) > 0x30) time.pin.nodes else time.pin.node;
const p = switch (now.plan.gait) {
.walk => std.math.clamp(now.since(.idea, 0) / far, 0, 1),
.run => now.moving(.idea, 0, time.run_ease),
.sprint => 1,
};
return .{ .from = from, .to = to, .p = p };
}
/// The tags on their way: from node to node along the band's bottom,
/// or arriving where there was none (fading in, rising 8), or leaving
/// for none (fading out).
fn tags(g: *const Nodes, u: ui.Ui, now: cursors.Now, things: []const objects.Object, places: []const Rect, label: f32) void {
const heap = theme.color.region.heap;
for (g.track) |name| {
const tag = g.tagOf(u, now, name);
if (!tag.moving() or tag.p <= 0) continue;
const a = placeOf(things, places, tag.from);
const b = placeOf(things, places, tag.to);
// It keeps the side it had where it leaves; one that comes to
// names already there goes on the stub's right.
const was_regs = (now.before().regs(g.cursor.rec.tid) catch null) orelse zt.Regs{};
const left_from = g.namesBefore(u, now, tag.from, was_regs);
const was_right = left_from.len >= 2 and !std.mem.eql(u8, left_from[0], name);
const crowded = was_right or (a == null and g.pins(u, now, tag.to).names.len > 0);
const names: []const []const u8 = if (crowded) &.{ "", name } else &.{name};
const ink = g.home(u, now, name);
const inks: []const u24 = if (crowded) &.{ t.primary, ink } else &.{ink};
if (a != null and b != null) {
const x = std.math.lerp(a.?.x + a.?.w / 2, b.?.x + b.?.w / 2, cursors.glide(tag.p));
u.pinUnderInked(x, a.?.y + a.?.h, names, inks, heap, label);
} else if (b) |r| {
const p = std.math.clamp(tag.p / (time.pin.in / time.pin.node), 0, 1);
u.faded(p).pinUnderInked(r.x + r.w / 2, r.y + r.h + (1 - p) * theme.time.caption_rise, names, inks, heap, label);
} else if (a) |r| {
u.faded(1 - std.math.clamp(tag.p / (time.pin.out / time.pin.node), 0, 1)).pinUnderInked(r.x + r.w / 2, r.y + r.h, names, inks, heap, label);
}
}
}
/// `text`: how much its names show: a register joining or leaving
/// crosses the middle of its change with them faded out, so the names
/// it leaves and those it gets never swap in a frame.
const Pins = struct { names: []const []const u8, inks: []const u24, shows: f32, text: f32 = 1 };
/// The registers that hold `addr` (before this step, and after it once
/// their link has landed), then the scene's variables that do.
fn pins(g: *const Nodes, u: ui.Ui, now: cursors.Now, addr: u64) Pins {
const rec = g.cursor.rec;
var out: std.ArrayList([]const u8) = .empty;
var inks: std.ArrayList(u24) = .empty;
var shows: f32 = 0;
var text: f32 = 1;
const is = (now.moment().regs(rec.tid) catch null) orelse zt.Regs{};
const was = (now.before().regs(rec.tid) catch null) orelse is;
// The scene's variables first: what the narration names, in the ink
// of where each lives. One on its way from another node is drawn
// apart (`tags`).
for (g.track) |name| {
const tag = g.tagOf(u, now, name);
// Where it is: at the node it leaves until it sets off.
const here = if (tag.p <= 0) tag.from else tag.to;
if ((tag.moving() and tag.p > 0) or here != addr) continue;
out.append(u.f.scratch, name) catch break;
inks.append(u.f.scratch, g.home(u, now, name)) catch break;
shows = 1;
}
if (!g.quiet) for (theme.metric.all_registers[0..16]) |name| {
const i = context.index(name).?;
const before = was.named(name) == addr;
const after = is.named(name) == addr;
if (!before and !after) continue;
const s = ties.pinShows(now, i, .node);
const this = if (before and after) 1 else if (after) s.new else s.old;
if (before != after) text = @min(text, @abs(2 * this - 1));
if (this < 0.5) continue;
out.append(u.f.scratch, name) catch break;
inks.append(u.f.scratch, t.primary) catch break;
shows = @max(shows, this);
};
// Names keep their side: the first to come is on the left, the next
// on the right, and a name that lands where another is stays on the
// right it travelled on; one left alone where it was on the right stays there.
const came = u.f.scratch.alloc(u64, out.items.len) catch return .{ .names = out.items, .inks = inks.items, .shows = shows, .text = text };
for (out.items, came) |name, *at| at.* = g.arrival(u, now, name, addr);
for (1..@max(out.items.len, 1)) |i| {
var k = i;
while (k > 0 and came[k - 1] > came[k]) : (k -= 1) {
std.mem.swap(u64, &came[k - 1], &came[k]);
std.mem.swap([]const u8, &out.items[k - 1], &out.items[k]);
std.mem.swap(u24, &inks.items[k - 1], &inks.items[k]);
}
}
// Both sides taken: a variable the scene names (what the narration
// follows) takes the right from a register, which is counted.
if (out.items.len > 2 and context.index(out.items[1]) != null) for (out.items[2..], 2..) |name, j| {
if (context.index(name) != null) continue;
var k = j;
while (k > 1) : (k -= 1) {
std.mem.swap([]const u8, &out.items[k - 1], &out.items[k]);
std.mem.swap(u24, &inks.items[k - 1], &inks.items[k]);
}
break;
};
if (out.items.len == 1) {
const first_before = g.firstBefore(u, now, addr, was);
if (first_before != null and !std.mem.eql(u8, first_before.?, out.items[0])) {
out.insert(u.f.scratch, 0, "") catch {};
inks.insert(u.f.scratch, 0, t.primary) catch {};
}
}
return .{ .names = out.items, .inks = inks.items, .shows = shows, .text = text };
}
/// When `name` came to point at `addr`: the moment its value last
/// became it (a variable's, its last assignment), as of the stop shown
/// (or the one before, for a name that is leaving).
fn arrival(g: *const Nodes, u: ui.Ui, now: cursors.Now, name: []const u8, addr: u64) u64 {
const rec = g.cursor.rec;
if (context.index(name)) |_| {
var i = if (rec.registers[now.stops[0]].named(name) == addr) now.stops[0] else now.stops[1];
while (i > 0 and rec.registers[i - 1].named(name) == addr) i -= 1;
return i;
}
const v = rec.variable(u.f.scratch, now.moment(), name) orelse return now.stops[0];
var i = if ((Recording.word(now.moment(), v.addr, 8) catch null) == addr) now.stops[0] else now.stops[1];
// Its assignment: a store, of a new value or of the one its slot held.
while (i > 0 and !Recording.touches(rec.written(i - 1, i), v.addr, 8) and !Recording.touches(rec.storedSame(i - 1, i), v.addr, 8)) i -= 1;
return i;
}
/// The first name on `addr`'s pin before this step, if another name was beside it.
fn firstBefore(g: *const Nodes, u: ui.Ui, now: cursors.Now, addr: u64, was: zt.Regs) ?[]const u8 {
const names = g.namesBefore(u, now, addr, was);
return if (names.len >= 2) names[0] else null;
}
/// The names on `addr`'s pin before this step, in their order (the first left).
fn namesBefore(g: *const Nodes, u: ui.Ui, now: cursors.Now, addr: u64, was: zt.Regs) []const []const u8 {
const rec = g.cursor.rec;
var out: std.ArrayList([]const u8) = .empty;
for (g.track) |name| {
const v = rec.variable(u.f.scratch, now.before(), name) orelse continue;
if (!rec.assigned(v, now.before().index)) continue;
if ((Recording.word(now.before(), v.addr, 8) catch null) != addr) continue;
out.append(u.f.scratch, name) catch break;
}
if (!g.quiet) for (theme.metric.all_registers[0..16]) |name| if (was.named(name) == addr) {
out.append(u.f.scratch, name) catch break;
};
return out.items;
}
/// The ink of where variable `name` lives: stack for a local, data for a global.
fn home(g: *const Nodes, u: ui.Ui, now: cursors.Now, name: []const u8) u24 {
const v = g.cursor.rec.variable(u.f.scratch, now.moment(), name) orelse return t.primary;
return rows.ink(rows.regionOf(now.moment(), v.addr));
}
};
/// A variable's tag: the node it was under before the step and the one
/// it is under after it (0: none), and how far it has gone.
const Tag = struct {
from: u64,
to: u64,
p: f32,
fn moving(tag: Tag) bool {
return tag.from != tag.to and tag.p < 1;
}
};
fn placeOf(things: []const objects.Object, places: []const Rect, addr: u64) ?Rect {
for (things, places) |o, place| if (o.addr == addr) return place;
return null;
}
/// From the pointer square at `start` (in the node at `from`) to the node
/// at `to`: straight to a node on its right; to one on its left, under
/// the nodes, in from below.
fn route(u: ui.Ui, start: ui.Vec, from: Rect, to: Rect) []const ui.Vec {
const out = u.f.scratch.alloc(ui.Vec, 4) catch return &.{};
if (to.x > from.x) {
out[0] = start;
out[1] = .{ to.x - 3, to.y + to.h / 2 };
return out[0..2];
}
const under = from.y + from.h + 6;
out[0] = .{ start[0], from.y + from.h };
out[1] = .{ start[0], under };
const into = to.x + (to.w - theme.metric.node.pointer_w) / 2;
out[2] = .{ into, under };
out[3] = .{ into, to.y + to.h + 1 };
return out;
}
|