diff options
Diffstat (limited to 'core/term')
| -rw-r--r-- | core/term/term.zig | 2 | ||||
| -rw-r--r-- | core/term/terminal.zig | 27 |
2 files changed, 10 insertions, 19 deletions
diff --git a/core/term/term.zig b/core/term/term.zig index b18f5875..59511727 100644 --- a/core/term/term.zig +++ b/core/term/term.zig @@ -32,7 +32,7 @@ pub const ops: iface.Ops = .{ .snapshot = cast(iface.Ops, "snapshot", terminal_.snapshot), .load = cast(iface.Ops, "load", terminal_.load), .reload = cast(iface.Ops, "reload", terminal_.reload), - .direct = cast(iface.Ops, "direct", terminal_.direct), + .media = terminal_.media, .feed = cast(iface.Ops, "feed", terminal_.feed), .grid = cast(iface.Ops, "grid", terminal_.grid), .viewTo = cast(iface.Ops, "viewTo", terminal_.viewTo), diff --git a/core/term/terminal.zig b/core/term/terminal.zig index 055c8981..e57193a6 100644 --- a/core/term/terminal.zig +++ b/core/term/terminal.zig @@ -195,11 +195,6 @@ pub const State = struct { /// the step reads the grid it had, as its replicas' replays do, and the /// rows sent them for it (Screens.fill) are of that grid's numbering. resize_to: ?struct { cols: u16, rows: u16 } = null, - /// Its program's kitty images by direct data alone (`direct`): a - /// replica's emulator, which is not the session's. A file, a temporary - /// file or shared memory is the session's machine's (and a temporary - /// one is deleted by its first reader): its image is absent here. - direct: bool = false, /// The stream over the emulator, its answers to the program and its /// size reports routed here, PNG decoded: what `create` and a dump's @@ -343,11 +338,11 @@ pub fn reload(s: *State) !u64 { var reply: [@typeInfo(@FieldType(State, "reply")).array.len]u8 = undefined; @memcpy(reply[0..saved.reply.len], saved.reply); saved.reply = reply[0..saved.reply.len]; - const kept = .{ s.changes, s.read, s.resize_to, s.direct }; + const kept = .{ s.changes, s.read, s.resize_to }; if (comptime images_enabled) s.images.deinit(gpa); s.stream.deinit(); s.vt.deinit(gpa); - s.* = .{ .gpa = gpa, .vt = decoded.toOwned(), .stream = undefined, .changes = kept[0] +% 1, .read = kept[1], .resize_to = kept[2], .direct = kept[3] }; + s.* = .{ .gpa = gpa, .vt = decoded.toOwned(), .stream = undefined, .changes = kept[0] +% 1, .read = kept[1], .resize_to = kept[2] }; // Short of room for its sequence in flight it goes on without it (lost // at the next cut), as ghostty's stream does: not worth a terminal. _ = install(s, decoded.continuation, &saved); @@ -357,8 +352,8 @@ pub fn reload(s: *State) !u64 { /// What a join compares of a snapshot (`reload`): every record of it but /// its kitty images' (tags 8 to 10, which ghostty's framing makes optional: /// snapshot/record.zig, a u16 tag, a u32 length, a u32 CRC and the payload, -/// after a 10-byte envelope): an image by file or shared memory is the -/// session's alone (P32, `direct`), and no digest reads an image. +/// after a 10-byte envelope): an animation's current frame is stepped by +/// each side's own draws, and no digest reads an image. fn joinHash(bytes: []const u8) u64 { const envelope = 10; const head = 10; @@ -379,7 +374,7 @@ fn joinHash(bytes: []const u8) u64 { /// whether its stream had all the room it wanted (`wire`). fn install(out: *State, continuation: ghostty_vt.snapshot.Continuation, saved: *const Term.Parts) bool { if (comptime images_enabled) inline for (.{ .primary, .alternate }) |which| { - if (out.vt.screens.get(which)) |screen| screen.kitty_images.image_limits = if (out.direct) .direct else .allWithTempDir(tempDir()); + if (out.vt.screens.get(which)) |screen| screen.kitty_images.image_limits = .allWithTempDir(tempDir()); }; const whole = out.wire(); switch (continuation) { @@ -409,14 +404,10 @@ fn install(out: *State, continuation: ghostty_vt.snapshot.Continuation, saved: * return whole; } -/// Its program's kitty images by direct data alone from now on: the -/// emulator of a replica that is not the session (P32). -pub fn direct(s: *State) void { - if (comptime !images_enabled) return; - s.direct = true; - inline for (.{ .primary, .alternate }) |which| { - if (s.vt.screens.get(which)) |screen| screen.kitty_images.image_limits = .direct; - } +/// How every terminal's kitty loader has a medium's bytes from now on +/// (ghostty's `read_medium`, build/patches.zig). +pub fn media(read: Term.Media) void { + if (comptime images_enabled) ghostty_vt.kitty.graphics.LoadingImage.read_medium = read; } /// The allocator it was opened with, its own from then on. |
