summaryrefslogtreecommitdiff
path: root/core/term
diff options
context:
space:
mode:
Diffstat (limited to 'core/term')
-rw-r--r--core/term/terminal.zig19
1 files changed, 15 insertions, 4 deletions
diff --git a/core/term/terminal.zig b/core/term/terminal.zig
index f130d7b9..44038a18 100644
--- a/core/term/terminal.zig
+++ b/core/term/terminal.zig
@@ -211,10 +211,22 @@ pub fn digest(s: *const State, h: *std.hash.Wyhash, view: bool) void {
const sb = screen.pages.scrollbar();
const cur = screen.cursor;
const offset = if (view) sb.offset else 0;
- // Whether it holds a kitty image: the tag says so (tagline.zig).
- const facts = .{ sb.total, offset, sb.len, cur.x, cur.y, s.vt.modes.get(.cursor_visible), s.vt.screens.active_key, s.reply_dropped, hasImages(s) };
+ // Everything a step reads of it (abi/term.zig `replicated`): its
+ // size, the view and the cursor, its modes (the alternate screen,
+ // the mouse's, focus reports, bracketed paste: `modes`), whether it
+ // holds a kitty image (the tag says so: tagline.zig), the reply
+ // buffer, the OSC 133 cycle (`prompt`), the active area's text. Not
+ // the history's text, only its length (a step's read of it: not
+ // covered; core/Term.zig `calls`).
+ const Modes = @TypeOf(s.vt.modes.values);
+ const mode_bits: @Int(.unsigned, @bitSizeOf(Modes)) = @bitCast(s.vt.modes.values);
+ const modes_word: @Int(.unsigned, (@bitSizeOf(Modes) + 7) / 8 * 8) = mode_bits;
+ const mouse_flags: [2]u8 = .{ @intCast(@intFromEnum(s.vt.flags.mouse_event)), @intCast(@intFromEnum(s.vt.flags.mouse_format)) };
+ const facts = .{ s.vt.cols, s.vt.rows, sb.total, offset, sb.len, cur.x, cur.y, modes_word, s.vt.screens.active_key, mouse_flags, s.reply_dropped, hasImages(s) };
inline for (facts) |fact| h.update(std.mem.asBytes(&fact));
h.update(s.reply[0..s.reply_len]);
+ var marks: [marks_len]u8 = undefined;
+ h.update(marksOf(s, &marks));
var buf: [4096]u8 = undefined;
var text: std.Io.Writer.Hashing(std.hash.Wyhash) = .initHasher(h.*, &buf);
if (screen.pages.getBottomRight(.active)) |br|
@@ -457,8 +469,7 @@ pub fn grid(state: ?*const State) Term.Grid {
}
/// What pardes made of a terminal's stream that its emulator does not hold
-/// (the OSC 133 cycle, MarkedHandler), as bytes two terminals' compare by
-/// (`expectSame`): phase u8, started, prompts, declined u32, continuation
+/// (the OSC 133 cycle, MarkedHandler), as bytes its digest holds: phase u8, started, prompts, declined u32, continuation
/// and lost u8, a finished command's seq u32 and status i32 (all ones:
/// none; i32 min: no status).
const marks_len = 1 + 4 * 3 + 2 + 4 + 4;