terminal/kitty-gfx: support "query", loading images, tests

This commit is contained in:
Mitchell Hashimoto
2023-08-20 14:34:33 -07:00
parent ec69644de6
commit c7658df978
6 changed files with 1119 additions and 864 deletions

View File

@@ -15,6 +15,7 @@ const ansi = @import("ansi.zig");
const modes = @import("modes.zig");
const charsets = @import("charsets.zig");
const csi = @import("csi.zig");
const kitty = @import("kitty.zig");
const sgr = @import("sgr.zig");
const Tabstops = @import("Tabstops.zig");
const trace = @import("tracy").trace;
@@ -1555,6 +1556,22 @@ pub fn getPwd(self: *const Terminal) ?[]const u8 {
return self.pwd.items;
}
/// Execute a kitty graphics command. The buf is used to populate with
/// the response that should be sent as an APC sequence. The response will
/// be a full, valid APC sequence.
///
/// If an error occurs, the caller should response to the pty that a
/// an error occurred otherwise the behavior of the graphics protocol is
/// undefined.
pub fn kittyGraphics(
self: *Terminal,
alloc: Allocator,
buf: []u8,
cmd: *kitty.graphics.Command,
) ?kitty.graphics.Response {
return kitty.graphics.execute(alloc, self, buf, cmd);
}
/// Full reset
pub fn fullReset(self: *Terminal) void {
self.primaryScreen(.{ .clear_on_exit = true, .cursor_save = true });