diff options
Diffstat (limited to 'dev/gui/gui.zig')
| -rw-r--r-- | dev/gui/gui.zig | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index da9a9150..3193d966 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1367,7 +1367,7 @@ const Client = struct { cl.lock.lockUncancelable(cl.io); defer cl.lock.unlock(cl.io); for (cl.inbox.items) |msg| switch (msg) { - .unit, .screen, .refused, .blob => |b| std.heap.c_allocator.free(b), + .unit, .refused, .blob => |b| std.heap.c_allocator.free(b), .checked, .ended, .left => {}, }; cl.inbox.clearRetainingCapacity(); @@ -1380,8 +1380,6 @@ const Client = struct { const link_ended = cl.link_ended; cl.lock.unlock(cl.io); for (cl.taken.items) |msg| { - // PARDES_TEST_LATENCY: when a terminal's delta came (an echo's). - if (msg == .screen) latencyNote("S {d}\n", .{monoNs()}); l.take(msg); // And after a unit, the first of its own inputs not confirmed. if (msg == .unit) { @@ -4917,7 +4915,17 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g else => {}, } else false; if (grid_bottom < win_h and tag_last) try addDecor(g, gpa, 0, grid_bottom, win_w, win_h, chrome.tag_bg, 1, win_w, win_h); - try paneDecor(g, gpa, regions, surface.rail_ticks[0..surface.nrail_ticks], chrome, layout, surface.cols, surface.rows, win_w, win_h); + try paneDecor(g, gpa, regions, surface.rail_ticks[0..surface.nrail_ticks], surface.heat.items, chrome, layout, surface.cols, surface.rows, win_w, win_h); + // The changes' lanes (jj.paint): a strip a level in the gutter's + // lane cells, each a third of a cell wide with half that of air + // before it, so three take one and a half cells (the ruled + // sample A); whole pixels, so every row's strip lines up. + for (surface.lanes.items) |lane| { + const w = @max(1, @round(layout.w / 3)); + const x0 = @round(@as(f32, @floatFromInt(lane.x)) * layout.w + w / 2 + @as(f32, @floatFromInt(lane.level)) * (w + w / 2)); + const y0 = @as(f32, @floatFromInt(lane.y)) * layout.h; + try addDecor(g, gpa, x0, y0, x0 + w, y0 + layout.h, lane.rgb, 1, win_w, win_h); + } // A single spine runs down each column, through every tag and body. for (regions) |column| { if (column.kind != .column) continue; @@ -4950,7 +4958,7 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g /// Each pane's rule between its tag and body, and its scroll rail: a page /// coloured gutter with a thin track and its thumb, running down through the /// pixels past the last whole row. -fn paneDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ticks: []const pardes.RailTick, chrome: *const pardes.Chrome, layout: CellLayout, cols: u16, rows: u16, win_w: f32, win_h: f32) !void { +fn paneDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ticks: []const pardes.RailTick, heat: []const pardes.RailHeat, chrome: *const pardes.Chrome, layout: CellLayout, cols: u16, rows: u16, win_w: f32, win_h: f32) !void { const page = chrome.page orelse bg_default; for (regions) |rail| { if (rail.kind != .rail or rail.rect.h == 0) continue; @@ -5029,6 +5037,14 @@ fn paneDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ti const ty = y0 + std.math.clamp(at * track_px, 0, track_px - h); try addDecor(g, gpa, column[0], ty, column[1], ty + h, if (tick.current) chrome.match_current else chrome.match_tick, 1, win_w, win_h); }; + // Churn's strip (jj.railHeat): beside the track, at the rail's + // right edge, a rail row each. + const strip_x1 = x0 + @as(f32, @floatFromInt(config.GUTTER)) * layout.w - dp(1); + const strip_x0 = @max(column[1], strip_x1 - dp(2)); + for (heat) |h| if (h.owner == rail.owner and h.row < rail.rect.h) { + const hy = y0 + @as(f32, @floatFromInt(h.row)) * layout.h; + try addDecor(g, gpa, strip_x0, hy, strip_x1, hy + layout.h, h.rgb, 1, win_w, win_h); + }; } } @@ -7693,7 +7709,7 @@ test "a detached GUI authority follows terminal directory changes with no window defer ptys.deinit(); var no_peers: replica.Peers = .{}; var shell: Shell = .{ .core = core, .io = io, .gpa = gpa, .lsp_allocator = gpa, .ptys = &ptys, .queue = &queue, .watches = undefined, .peers = &no_peers }; - const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", start, 24, 80); + const child = try host_io.forkShell(null, 0, &rcs, "/bin/sh", start, .{ .cols = 80, .rows = 24 }); ptys.slots[0] = .{ .fd = child.file.handle, .pid = child.pid }; try std.testing.expect(host_io.writeFd(child.file.handle, "cd child\n")); const until = std.Io.Clock.awake.now(io).toMilliseconds() + 2_000; |
