summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-22 09:50:43 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:24 -0300
commita8b457a306a4442975210bcac3f04b56513c61c3 (patch)
tree6e2026ecb15da2fb919a0202f5d8b38e3b36a595 /src/tty
parenta8a1499bdffffc5b6919e24ec957e92fabaf003b (diff)
parent7e9d2c4169245072265b483ffaa6aa05f23f08d3 (diff)
downloadpardes-a8b457a306a4442975210bcac3f04b56513c61c3.tar.gz
pardes-a8b457a306a4442975210bcac3f04b56513c61c3.zip
Merge: Def/Refs, the diff viewer, Helix n/N, Callstack, Zig 0.17, Window mode and the terminal cwd fix onto 0.24
The docs keep both sides: 0.24's Ctrl-i fallbacks and typed ls with this line's Window mode, raw Esc and Helix n/N wording. The CHANGELOG's unreleased entries go above 0.24, Def/Refs and the context rows among them. cheatsheet-a4.pdf rendered again; .scratch/ ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index ca2cb939..4cd1bc9a 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 {
@@ -1737,7 +1737,7 @@ const Shell = struct {
};
for (&s.ptys, 0..) |*slot, id| if (slot.*) |pt| {
var lbuf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined;
- if (host_io.shellCwd(pt.pid, &lbuf)) |cwd| s.core.setCwd(id, cwd);
+ if (host_io.ttyCwd(pt.pid, pt.file.handle, s.core.settings.shell.effective.get(), &lbuf)) |cwd| s.core.setCwd(id, cwd);
};
if (s.caps_pending and s.vx.queries_done.load(.unordered)) {
@@ -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);