summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 16:50:34 -0300
committerGabriel Schneider <[email protected]>2026-11-22 16:53:19 -0300
commit9863a63b614d200852853825031189364dcacfdc (patch)
treed235648a2ac14b3e311746ced3433ed6865e2061 /core/Core.zig
parent6544f73a6b50e5ba68564beea7784593bb54348e (diff)
parentbad506bd45846e012246a33b5d3097b3e92f02bc (diff)
downloadpardes-9863a63b614d200852853825031189364dcacfdc.tar.gz
pardes-9863a63b614d200852853825031189364dcacfdc.zip
integration: the old road deleted and the emulator's boundary on the gathered line: pardes-merge56 (`qvwrwxtu`: the installed tree and the source view's changes to their last slice) and pardes-term-join-9 (`twssqzqw`, fourteen changes on pardes-merge55: every client's terminals by the pty's bytes and nothing else: the delta protocol, its flow control and core/term/screen_state.zig deleted (-3,605 +504 lines), the wire at 30, one soak; S1: abi/term.zig's Ops in replicated and local, the terminal's digest covering what a step reads, every call of the core's into a terminal listed with its rule as a test; a client's own join again judged after its goodbye; a pty's size one fact the core hands its host for every fork, adopt and resize; a closed view sizes no terminal); no textual conflict; one semantic one, resolved here: core/jj.zig's Churn test (the layers' last round) called Authority.init and Replica.init with the road's flag the deletion took away: the argument removed; core-test 916/1073 (157 skipped), shell-test 1115/1118; its gate: .scratch/sketch/reorg/merge57, the numbers in PARDES.md (2026-11-22)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig33
1 files changed, 21 insertions, 12 deletions
diff --git a/core/Core.zig b/core/Core.zig
index ae9ba52f..2b0a898d 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -950,8 +950,9 @@ fn reportFocus(p: *Pardes) void {
// A client's own step records what it told and writes nothing: the
// session's step makes the write, off the tape on both sides
// (tape.hostCall's pty_write), so the switch shows at once and the
- // program hears of it a round trip later.
- if (p.tape.speculating and p.tape.screen_state) return;
+ // program hears of it a round trip later (a write there would stop the
+ // speculation: pty_write is `keeps_stopping`'s).
+ if (p.tape.speculating) return;
if (v.focus_told) |old| if (p.panes[old.id]) |pane| {
if (pane.serial == old.serial and pardes.Term.modes(pane.terminal).focus) p.emitWrite(old.id, "\x1b[O");
};
@@ -1685,7 +1686,6 @@ fn updateInner(p: *Pardes, ev: Event) void {
pane.shell_spoke = true;
ctlfs.events.notePtyOutput(p, o.pane.index(), o.bytes);
pane.feedOutput(p, o.bytes);
- pane.term_images = if (p.tape.screen_state) p.tape.value(.images, pardes.Term.hasImages, .{pane.terminal}) else pardes.Term.hasImages(pane.terminal);
ctlfs.pty.noteMarks(p, o.pane.index(), pane);
exec.flushReplEnter(p, o.pane.index(), true);
},
@@ -2014,6 +2014,16 @@ pub fn sync(p: *Pardes) void {
tagline.revealHeader(p);
}
+/// Pane `id`'s pty as its host is to size it: its grid (or `cells`, a
+/// size 9P's pty/ctl gave), in pixels at the cell of the view that sizes
+/// it: a program sizes its kitty graphics by them.
+pub fn ptySize(p: *const Pardes, id: Pane.Id, cells: ?[2]u16) pardes.PtySize {
+ const pane = p.panes[id.index()] orelse return .{ .cols = 1, .rows = 1 };
+ const c = cells orelse .{ pane.cols, pane.rows };
+ const cell = (if (pane.sized_by) |k| p.views[k] orelse p.views[p.live].? else p.views[p.live].?).cell_pixels;
+ return .{ .cols = @max(c[0], 1), .rows = @max(c[1], 1), .w_px = std.math.cast(u16, @as(u32, c[0]) * cell.w) orelse 0, .h_px = std.math.cast(u16, @as(u32, c[1]) * cell.h) orelse 0 };
+}
+
/// The view typing goes into is the one its terminal is sized for
/// (`sizes`).
fn typedInto(p: *Pardes) void {
@@ -2021,16 +2031,15 @@ fn typedInto(p: *Pardes) void {
}
/// Whether the live view sizes terminal `pane`: a terminal shown at two
-/// sizes takes the size of the view that typed into it last, and any
-/// view's once that one is gone. The others show it at that size, a
-/// shorter one passed down to its cursor (`Pane.pan`, Pane.panFor).
+/// sizes takes the size of the view that typed into it last, and keeps it
+/// once that view is gone until another types into it (views.dropView):
+/// a view nobody types in never takes it. The others show it at that
+/// size, a shorter one passed down to its cursor (`Pane.pan`,
+/// Pane.panFor).
// ponytail: a panned view's pointer reports to a terminal's program and
// its kitty images are placed as the unpanned rows are.
-fn sizes(p: *Pardes, pane: *Pane) bool {
- if (pane.sized_by == p.live) return true;
- if (Views.isOpen(p, pane.sized_by)) return false;
- pane.sized_by = p.live;
- return true;
+fn sizes(p: *const Pardes, pane: *const Pane) bool {
+ return pane.sized_by == p.live;
}
pub fn theme(p: *const Pardes) *const Theme {
@@ -2889,7 +2898,7 @@ test "a spawn is for the pane it was made for, not whatever took the slot since"
var command: [32]u8 = undefined;
var core: *Pardes = undefined;
const vtable: Host.VTable = .{ .spawn = spawn };
- fn spawn(_: ?*anyopaque, id: pardes.Pane.Id, _: []const u8) void {
+ fn spawn(_: ?*anyopaque, id: pardes.Pane.Id, _: []const u8, _: pardes.PtySize) void {
const pane = id.index();
spawns += 1;
const line = core.panes[pane].?.command.?;