From ba10cc4ff30d08d27ad35576df04a03282b6521b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 19 Nov 2026 22:15:16 -0300 Subject: Term: the two things a speculation writes into a terminal and no rollback puts back move into the pane, which the copy holds and the digest covers: the cell its program last heard the mouse at (Pane.term_mouse, handed to Term.mouse and Term.wheel, which ghostty's encoder reads and writes) and its kitty graphics as glyph art (Pane.term_petscii, which the Petscii builtin flips and the images' draw takes in ImagesAt): the sizing's table (reports/pardes-term-bytes.md, section 1; the brief's step 1c); Parts loses both (a dump of an older build carries them and they are passed over by name: a terminal's Petscii chosen before an Upgrade is off after it), Ops loses petscii and togglePetscii; term-test 17/17, core-test 848/991 (143 skipped), shell-test 1027/1030 Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/Term.zig | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'core/Term.zig') diff --git a/core/Term.zig b/core/Term.zig index 5025ba2b..82d5dad7 100644 --- a/core/Term.zig +++ b/core/Term.zig @@ -30,6 +30,8 @@ pub const Moves = iface.Moves; pub const MouseMods = iface.MouseMods; pub const MouseButton = iface.MouseButton; pub const MouseAction = iface.MouseAction; +/// A grid cell (the one a program last heard the mouse at: Pane.term_mouse). +pub const Coordinate = iface.Parts.Coordinate; pub const Page = iface.Page; pub const Span = iface.Span; pub const Ink = iface.Ink; @@ -212,13 +214,13 @@ pub fn key(s: *State, k: plain.Key, out: *std.Io.Writer) !void { /// One mouse event for its program, as the mode and format it set ask for /// it; empty when the program does not hear of it. -pub fn mouse(s: *State, buf: *[64]u8, action: MouseAction, button: ?MouseButton, mods: MouseMods, col: i32, row: i32, any_pressed: bool) []const u8 { - return the().mouse(s.impl, buf, action, button, mods, col, row, any_pressed); +pub fn mouse(s: *State, last: *?Coordinate, buf: *[64]u8, action: MouseAction, button: ?MouseButton, mods: MouseMods, col: i32, row: i32, any_pressed: bool) []const u8 { + return the().mouse(s.impl, last, buf, action, button, mods, col, row, any_pressed); } /// A wheel turn for its program; null when the wheel is not the program's. -pub fn wheel(s: *State, buf: *[64]u8, turn: MouseButton, col: u16, row: u16, mods: MouseMods) ?[]const u8 { - return the().wheel(s.impl, buf, turn, col, row, mods); +pub fn wheel(s: *State, last: *?Coordinate, buf: *[64]u8, turn: MouseButton, col: u16, row: u16, mods: MouseMods) ?[]const u8 { + return the().wheel(s.impl, last, buf, turn, col, row, mods); } /// A paste as xterm makes one: three parts, the text between the brackets @@ -362,17 +364,6 @@ pub fn images(s: *State, gpa: std.mem.Allocator, at: ImagesAt, out: *std.ArrayLi the().images(s.impl, gpa, at, out, frame, frame_cols); } -/// The Petscii builtin on it: its kitty graphics as glyph art, or back to -/// pixels; null for none. -pub fn petscii(s: ?*const State) ?bool { - const o = ops orelse return null; - return o.petscii(if (s) |state| state.impl else null); -} - -pub fn togglePetscii(s: *State) void { - the().togglePetscii(s.impl); -} - /// Whether the screen showing holds any kitty graphics image. pub fn hasImages(s: ?*const State) bool { const o = ops orelse return false; -- cgit v1.3