summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 14:35:15 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commitbc3d18d27f9fc1155db7fac3946c4d38774f9e65 (patch)
tree9178ce95952797f8a78b16c2b805e53368efb35a /src/tty
parent1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (diff)
downloadpardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.tar.gz
pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.zip
Build with Zig 0.17
ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index ca2cb939..82cb40bd 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -129,7 +129,7 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void {
var parser: vaxis.Parser = .{};
var buf: [1024]u8 = undefined;
var carried: usize = 0;
- while (!loop.should_quit) {
+ while (true) { // stopInput cancels the task; the read then fails with Canceled
if (carried == buf.len) return error.InputSequenceTooLong;
const received = try tty.read(buf[carried..]);
if (received == 0) return;
@@ -295,7 +295,7 @@ test "terminal input preserves fragmented keys queries paste and text after EOF"
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), _: u32) bool {
+ pub fn inputFollows(self: *@This(), _: u32) bool {
return self.next < self.parts.len;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -380,7 +380,7 @@ test "terminal replies and malformed sequences never become typed text" {
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), _: u32) bool {
+ pub fn inputFollows(self: *@This(), _: u32) bool {
return self.next < self.parts.len;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -465,7 +465,7 @@ test "terminal input split at every byte with a gap reads as it does whole" {
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), ms: u32) bool {
+ pub fn inputFollows(self: *@This(), ms: u32) bool {
return self.next < self.parts.len and self.gap_ms <= ms;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -561,7 +561,7 @@ test "an ESC read by itself is the Escape key at once" {
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), _: u32) bool {
+ pub fn inputFollows(self: *@This(), _: u32) bool {
self.asked = true;
return self.next < self.parts.len;
}
@@ -609,7 +609,7 @@ test "a frame's answer is taken wherever the reads cut it, and never typed" {
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), _: u32) bool {
+ pub fn inputFollows(self: *@This(), _: u32) bool {
return self.next < self.parts.len;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -701,7 +701,7 @@ test "terminal input cancellation joins blocked reads and queued EOF" {
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(_: *@This(), _: u32) bool {
+ pub fn inputFollows(_: *@This(), _: u32) bool {
return false;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -2332,7 +2332,7 @@ test "a terminal pane gets function keys as their sequences and lone modifiers n
fn getWinsize(_: *@This()) !vaxis.Winsize {
return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 };
}
- fn inputFollows(self: *@This(), _: u32) bool {
+ pub fn inputFollows(self: *@This(), _: u32) bool {
return self.next < self.parts.len;
}
fn read(self: *@This(), buf: []u8) !usize {
@@ -3033,7 +3033,7 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer core.deinit();
- _ = try core.setTestFile("some text on a line\n" ** 20);
+ _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*))));
try std.testing.expect(core.executeBuiltinLine(0, "Theme forge"));
core.settings.jump_trail = true;
for (0..40) |_| core.update(.tick);
@@ -3078,7 +3078,7 @@ test "a notice chip casts a cell's shadow right and down, inside its body, off t
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer core.deinit();
- _ = try core.setTestFile("some text on a line\n" ** 20);
+ _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*))));
try std.testing.expect(core.executeBuiltinLine(0, "Theme forge"));
core.settings.chip_shadow = true;
try std.testing.expect(core.executeBuiltinLine(0, "Msg a notice"));
@@ -3114,7 +3114,7 @@ test "a scrolled pane's thumb brightens and fades back in 250 ms" {
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer core.deinit();
- const pane = try core.setTestFile("some text on a line\n" ** 200);
+ const pane = try core.setTestFile(std.mem.asBytes(&@as([200][20]u8, @splat("some text on a line\n".*))));
try std.testing.expect(core.executeBuiltinLine(0, "Theme forge"));
core.settings.thumb_flash = true;
for (0..40) |_| core.update(.tick);