summaryrefslogtreecommitdiff
path: root/core/Term.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 03:03:55 -0300
committerGabriel Schneider <[email protected]>2026-11-22 10:31:04 -0300
commit9158de5d50831e115e14e2ed502300ee8c1d9930 (patch)
tree2b5e60569307e02d82b19bd419279392a6da257b /core/Term.zig
parent70c9e3fbf9cdc7139b4da0142f3a44741a7e1491 (diff)
downloadpardes-9158de5d50831e115e14e2ed502300ee8c1d9930.tar.gz
pardes-9158de5d50831e115e14e2ed502300ee8c1d9930.zip
term: screen_state.zig deleted, and the terminal module's side of the delta road (the old road's deletion, piece 5 of 8): core/term/screen_state.zig (1,213 lines: the encoder, tracks, peers' flights, a replica's apply and holes, its own soak and four tests) goes whole; core/term/terminal.zig loses `encode`/`encodeRows`/`encoder`/`encoderFree`/`track`/`untrack`/`replica`/`replicaFree`/`replicaTop`/`missing`/`apply`/`applyRows`/`shown`/`blank`, `takeMarks` (`marksOf` stays, private: the tests compare two terminals by it), the State's `changes` (a version's counter for the tracks), `read` with `markRead`/`wasRead`/`clearRead` (the rows a step read, for the fills), and `resize_to` with `resizeDeferred` and `resize`'s `later` (screen state's authority sized its terminals after a step's unit); abi/term.zig loses the `Encoder`/`Track`/`Replica` handles, `flight_bound`, `Peer`, `Applied` and those entries of `Ops` (and `dumpScreen`, which nothing in the core called); core/Term.zig its wrappers; core/term/term.zig its ops, its handle map and its `screen_state` export; core/panes.zig its `resizeDeferred` and resizes now (its later screen-state lines go in piece 6); core/edit.zig its `markRead`; the cell-for-cell dump the soak compares a client's terminal with its session's by moves to terminal.zig (`dumpScreen`, over the emulator), the soak's three streams (a shell's, a full-screen program's, `yes`) into test/replicas.zig, their one user; test/terminal.zig loses `a replica's terminal pane draws as its authority's does` (a delta's) and `a terminal made fresh has no size waiting` (`resize_to`'s); core-test 911/1068 (157 skipped), shell-test 1110/1113, term-test 15/15, pane-test 181/182 (again after the machines reboot, on a wiped cache), the soaks small run and `--echo` rc 0
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Term.zig')
-rw-r--r--core/Term.zig102
1 files changed, 4 insertions, 98 deletions
diff --git a/core/Term.zig b/core/Term.zig
index 6ef9b0a5..86c7518b 100644
--- a/core/Term.zig
+++ b/core/Term.zig
@@ -50,14 +50,9 @@ pub const Painted = iface.Painted;
pub const PaintedRow = iface.PaintedRow;
pub const ImagesAt = iface.ImagesAt;
pub const EchoCell = iface.EchoCell;
-pub const Peer = iface.Peer;
-pub const Applied = iface.Applied;
-pub const Encoder = iface.Encoder;
-pub const Track = iface.Track;
-pub const Replica = iface.Replica;
fn the() *const iface.Ops {
- return ops orelse unreachable; // no State, Encoder or Replica is made without it
+ return ops orelse unreachable; // no State is made without it
}
/// A terminal pane's terminal: the module's handle, and the walk's hooks
@@ -236,16 +231,11 @@ pub fn follow(s: *State) void {
the().follow(s.impl);
}
-/// Its grid reflowed, now or when `resizeDeferred` makes it.
-pub fn resize(s: *State, cols: u16, rows: u16, later: bool) void {
+/// Its grid reflowed.
+pub fn resize(s: *State, cols: u16, rows: u16) void {
writes +%= 1;
s.written = true;
- the().resize(s.impl, cols, rows, later);
-}
-
-pub fn resizeDeferred(s: *State) bool {
- writes +%= 1;
- return the().resizeDeferred(s.impl);
+ the().resize(s.impl, cols, rows);
}
/// Its cells' size in pixels (kitty graphics, CSI 14/16 t).
@@ -365,12 +355,6 @@ pub fn promptPrefix(tab: u16, s: ?*State, row: i32, raw: []const u8) usize {
};
}
-/// A step read its rows: its replicas must hold them for the step's
-/// replay.
-pub fn markRead(s: *State) void {
- the().markRead(s.impl);
-}
-
/// What a predicted echo reads of a cell of its active area.
pub fn echoCell(s: *const State, x: u16, y: u16) ?EchoCell {
return the().echoCell(s.impl, x, y);
@@ -425,84 +409,6 @@ pub fn hasImages(s: ?*const State) bool {
return o.hasImages(if (s) |state| state.impl else null);
}
-// ---- its replicas ----
-
-pub fn encoder(gpa: std.mem.Allocator) !*Encoder {
- return the().encoder(gpa);
-}
-
-pub fn encoderFree(e: *Encoder) void {
- the().encoderFree(e);
-}
-
-pub fn track(gpa: std.mem.Allocator) !*Track {
- return the().track(gpa);
-}
-
-/// A peer's track of it let go (`s` null: it is gone).
-pub fn untrack(t: *Track, gpa: std.mem.Allocator, s: ?*State) void {
- the().untrack(t, gpa, if (s) |state| state.impl else null);
-}
-
-/// What a peer is owed of it, a delta against what the peer was sent.
-pub fn encode(s: *State, e: *Encoder, t: *Track, peer: *Peer, out: *std.Io.Writer) !bool {
- return the().encode(s.impl, e, t, peer, out);
-}
-
-/// Rows of it a replica holds as holes.
-pub fn encodeRows(s: *State, e: *Encoder, t: *Track, lo: u64, hi: u64, out: *std.Io.Writer) !void {
- return the().encodeRows(s.impl, e, t, lo, hi, out);
-}
-
-/// Whether a step read its rows since `clearRead`.
-pub fn wasRead(s: *const State) bool {
- return the().wasRead(s.impl);
-}
-
-pub fn clearRead(s: *State) void {
- the().clearRead(s.impl);
-}
-
-/// A replica's side of one terminal: made, freed, where its active area
-/// begins, and the history rows it does not hold.
-pub fn replica(gpa: std.mem.Allocator) !*Replica {
- return the().replica(gpa);
-}
-
-pub fn replicaFree(r: *Replica, gpa: std.mem.Allocator) void {
- the().replicaFree(r, gpa);
-}
-
-pub fn replicaTop(r: *const Replica) u64 {
- return the().replicaTop(r);
-}
-
-pub fn missing(r: *const Replica, lo: u64, hi: u64, out: *std.ArrayList([2]u64), gpa: std.mem.Allocator) !void {
- return the().missing(r, lo, hi, out, gpa);
-}
-
-/// A replica's side: a delta applied, rows applied, the rows its view
-/// shows, rows blank until they come.
-pub fn apply(s: *State, r: *Replica, bytes: []const u8) !Applied {
- return the().apply(s.impl, r, bytes);
-}
-
-pub fn applyRows(s: *State, r: *Replica, bytes: []const u8) !void {
- return the().applyRows(s.impl, r, bytes);
-}
-
-pub fn shown(s: *State, r: *const Replica) [2]u64 {
- return the().shown(s.impl, r);
-}
-
-pub fn blank(s: *State, r: *const Replica, lo: u64, hi: u64) void {
- the().blank(s.impl, r, lo, hi);
-}
-
-pub fn dumpScreen(s: *State, w: *std.Io.Writer) !void {
- return the().dumpScreen(s.impl, w);
-}
-
// ---- a core without a terminal (core-test's) ----
test "a core without a terminal boots to a scratch pane" {