summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 12:57:47 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit30c2c8a154e770b3920bcfd7d553825fe9182bf4 (patch)
treeecdce274f1cb25095c72f4da62b7c35e23aee04c /src/tty
parent8f31fc6bfaae2d29b2bb5cc2149fcd7033cd9724 (diff)
downloadpardes-30c2c8a154e770b3920bcfd7d553825fe9182bf4.tar.gz
pardes-30c2c8a154e770b3920bcfd7d553825fe9182bf4.zip
Move the frame into draw.zig and the transitions out of layout.zig
Pure moves, no behaviour change. draw.zig holds the whole core frame in order: render, the pane, tag, header and notice painters it calls, and the character-effect composition (Pardes.render stays a declaration alias). Presentation.zig is the panel presentation state as a file struct, and animation.zig the easing curves, transition kinds, tracks and boxes, the character effects' sources and the generic displayed-value transition, all of which lived in layout.zig. layout.zig keeps only layout.
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/panel_compositor.zig27
-rw-r--r--src/tty/tty.zig4
2 files changed, 16 insertions, 15 deletions
diff --git a/src/tty/panel_compositor.zig b/src/tty/panel_compositor.zig
index 9363841a..67d3a6e6 100644
--- a/src/tty/panel_compositor.zig
+++ b/src/tty/panel_compositor.zig
@@ -8,9 +8,10 @@
const std = @import("std");
const pardes = @import("../pardes.zig");
const layout = @import("../layout.zig");
+const animation = @import("../animation.zig");
-const Box = layout.Box;
-const Track = layout.Track;
+const Box = animation.Box;
+const Track = animation.Track;
/// Kitty placements cannot be resampled through the character-grid transform.
/// Keep their transmitted pixels cached, but omit the placement while its pane
@@ -77,7 +78,7 @@ pub fn compose(
// Stable layout motion first, newly opening panels above it, and closing
// tombstones last. A closing pane no longer owns input or canonical cells,
// but its frozen old content remains the top visual until it slides out.
- for ([_]layout.Phase{ .moving, .opening, .closing }) |phase| {
+ for ([_]animation.Phase{ .moving, .opening, .closing }) |phase| {
for (tracks) |track| {
if (!drawable(source, track) or track.phase != phase) continue;
switch (track.effect) {
@@ -139,7 +140,7 @@ fn dissolve(out: *pardes.Surface, source: *const pardes.Surface, track: Track) v
var x = area.x0;
while (x < area.x1) : (x += 1) {
if (!source.panelCellChanged(x, y)) continue;
- if (layout.dissolveRevealed(
+ if (animation.dissolveRevealed(
track.serial,
x - area.x0,
y - area.y0,
@@ -339,7 +340,7 @@ test "TTY content effects never touch cells outside the published diff" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
- for ([_]layout.Transition{ .ascii, .dissolve }) |effect| {
+ for ([_]animation.Transition{ .ascii, .dissolve }) |effect| {
const track: Track = .{
.serial = 17,
.effect = effect,
@@ -366,7 +367,7 @@ test "content transition without a diff snaps to canonical surface" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
- for ([_]layout.Transition{ .dissolve, .ascii, .vertical }) |effect| {
+ for ([_]animation.Transition{ .dissolve, .ascii, .vertical }) |effect| {
const track: Track = .{
.effect = effect,
.phase = .opening,
@@ -391,7 +392,7 @@ test "exact transition endpoint preserves the canonical cursor" {
};
const track: Track = .{
.effect = .ascii,
- .frame = layout.Transition.ascii.frames() - 1,
+ .frame = animation.Transition.ascii.frames() - 1,
.from = .{ .w = 1, .h = 1 },
.to = .{ .w = 1, .h = 1 },
};
@@ -431,7 +432,7 @@ test "vertical opening rises through a fixed old-grid clip" {
.serial = 5,
.phase = .opening,
.effect = .vertical,
- .from = layout.openingBox(.vertical, target, 3),
+ .from = animation.openingBox(.vertical, target, 3),
.to = target,
};
@@ -485,7 +486,7 @@ test "vertical closing drops frozen content over canonical cells" {
.phase = .closing,
.effect = .vertical,
.from = old_box,
- .to = layout.closingBox(.vertical, old_box),
+ .to = animation.closingBox(.vertical, old_box),
};
const first = try compose(arena.allocator(), &surface, &.{track}, null);
@@ -530,13 +531,13 @@ test "closing content paints after opening content regardless of track order" {
.phase = .closing,
.effect = .vertical,
.from = box,
- .to = layout.closingBox(.vertical, box),
+ .to = animation.closingBox(.vertical, box),
};
const opening: Track = .{
.serial = 2,
.phase = .opening,
.effect = .ascii,
- .frame = layout.Transition.ascii.frames() - 1,
+ .frame = animation.Transition.ascii.frames() - 1,
.from = box,
.to = box,
};
@@ -691,8 +692,8 @@ test "active panel transition hides only its own native attachment" {
const tracks = [_]Track{
.{ .serial = 41, .effect = .slide, .frame = 0 },
.{ .serial = 42, .effect = .ascii, .frame = 0 },
- .{ .serial = 43, .effect = .zoom, .frame = layout.Transition.zoom.frames() - 1 },
- .{ .serial = 44, .effect = .zoom, .frame = layout.Transition.zoom.frames() },
+ .{ .serial = 43, .effect = .zoom, .frame = animation.Transition.zoom.frames() - 1 },
+ .{ .serial = 44, .effect = .zoom, .frame = animation.Transition.zoom.frames() },
.{ .serial = 45, .phase = .opening, .effect = .vertical, .frame = 0 },
};
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index 32f9138f..66e551b1 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -899,7 +899,7 @@ const Shell = struct {
caps_pending: bool = true,
check_files: bool = false,
in_paste: bool = false,
- tracks: []const pardes.layout.Track = &.{},
+ tracks: []const pardes.animation.Track = &.{},
fn of(ctx: ?*anyopaque) *Shell {
return @ptrCast(@alignCast(ctx.?));
@@ -1532,7 +1532,7 @@ fn tickWatch(io: std.Io, loop: *Loop) void {
while (true) {
tick_request.waitUncancelable(io);
tick_request.reset();
- var ts: libc.timespec = .{ .sec = 0, .nsec = @as(isize, pardes.layout.Animation.frame_ms) * std.time.ns_per_ms };
+ var ts: libc.timespec = .{ .sec = 0, .nsec = @as(isize, pardes.animation.Animation.frame_ms) * std.time.ns_per_ms };
_ = libc.nanosleep(&ts, null);
loop.postEvent(.tick) catch {};
}