summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Core.zig28
-rw-r--r--src/Event.zig13
-rw-r--r--src/Output.zig2
-rw-r--r--src/TerminalImages.zig2
-rw-r--r--src/builtins.zig8
-rw-r--r--src/dump.zig2
-rw-r--r--src/edit.zig2
-rw-r--r--src/exec.zig2
-rw-r--r--src/gui/gui.zig14
-rw-r--r--src/image.zig2
-rw-r--r--src/keys.zig2
-rw-r--r--src/macos.zig2
-rw-r--r--src/ninep/ctl.zig10
-rw-r--r--src/pdf_view.zig14
-rw-r--r--src/tagline.zig4
-rw-r--r--src/tape.zig2
-rw-r--r--src/terminal.zig10
-rw-r--r--src/tui/tui.zig12
-rw-r--r--src/views.zig4
19 files changed, 70 insertions, 65 deletions
diff --git a/src/Core.zig b/src/Core.zig
index c5665cb5..0efe447b 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -23,6 +23,7 @@ const Handover = pardes.Handover;
const Host = pardes.Host;
const ImagePlace = pardes.ImagePlace;
const Jump = pardes.Jump;
+const Frontend = @import("Event.zig").Frontend;
const Ask = pardes.lsp.Ask;
const Key = pardes.Key;
const Loc = Jump.Loc;
@@ -193,11 +194,10 @@ theme_file_pane: u8 = 0,
chrome: colors.ChromeTheme = colors.initial_chrome,
/// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES).
frames: FrameStats = .{},
-native_images: bool = false,
-/// The shell can take a changed image a few rows at a time (a texture row
-/// upload, a shared-memory hand-off), so a PDF selection is repainted as
-/// it is dragged instead of once on release.
-native_image_patches: bool = false,
+/// The live view's frontend (Event.frontend): a window, what it draws and
+/// the words it takes (builtins.zig `here`); it starts as
+/// `Options.windowed` says.
+frontend: Frontend = .{ .windowed = false },
quit: bool = false,
/// A detached session with no frontend attached: nothing renders, so
/// no input ever dismisses a message (Messages.expireUnattended).
@@ -218,14 +218,10 @@ pointer_raw_row: u16 = 0,
pointer_body_hit: ?Mouse.BodyHit = null,
pointer_tag_hit: ?TagHit = null,
raw_hover_intent: bool = false,
-pointer_inside: bool = false,
/// A pixel shell's window, which hears the pointer leave it: only then
/// does /status say whether the pointer is over it (a terminal's mouse
/// reports never say it left, so a tty would claim it for ever).
-/// The live view's frontend is a window (Event.frontend): what it draws,
-/// and the words it takes (builtins.zig `here`). It starts as
-/// `Options.windowed` says.
-windowed: bool = false,
+pointer_inside: bool = false,
/// The last plain B1 click, for acme's double-click (text.c:881,
/// textselect: a second click at the same point within 500 ms).
last_click: ?struct { id: usize, on_tag: bool, row: i32, col: i32, ms: i64 } = null,
@@ -396,7 +392,7 @@ pub const replica = .{
// A frame, and the timings that make it.
"surface", "frames", "chrome",
"frame_arena", "scratch",
- "needs_frame", "present_skipped", "native_image_patches",
+ "needs_frame", "present_skipped",
"echo",
// Drained by every pump before its digest; a replica's queues
// are its own.
@@ -471,7 +467,7 @@ pub fn create(gpa: std.mem.Allocator, opts: Options) !*Pardes {
.pdf_gpa = opts.pdf_allocator orelse gpa,
.tree_sitter_gpa = opts.tree_sitter_allocator orelse gpa,
.opts = opts,
- .windowed = opts.windowed,
+ .frontend = .{ .windowed = opts.windowed },
.tty_toggle = opts.tty_toggle,
.col_tags = @splat(.{ .what = .column, .gpa = gpa }),
.global_tag = .{ .what = .workspace, .gpa = gpa },
@@ -1614,7 +1610,7 @@ pub fn update(p: *Pardes, ev: Event) void {
if (comptime pdf_enabled) {
if (scroll.pane < MAX_PANES) {
if (p.panes[scroll.pane]) |pane| {
- if (pane.hasPdf() and p.native_images)
+ if (pane.hasPdf() and p.frontend.native_images)
_ = pardes.panes.Pdf.scrollPane(p, pane, @floatCast(scroll.delta_pixels), scroll.glide);
}
}
@@ -1631,9 +1627,7 @@ pub fn update(p: *Pardes, ev: Event) void {
},
.handed => |h| p.handover.finish(p, h.seq, h.to, h.failure),
.frontend => |f| {
- p.windowed = f.windowed;
- p.native_images = f.native_images;
- p.native_image_patches = f.native_image_patches;
+ p.frontend = f;
},
.pointer_leave => {
p.pointer_inside = false;
@@ -2126,7 +2120,7 @@ pub const Boot = enum {
pub const Options = struct {
tty_only: bool = false,
- /// The first view's frontend is a window (`Pardes.windowed`), as a
+ /// The first view's frontend is a window (`Pardes.frontend`), as a
/// window's build says: an option, taped with the rest, so that a
/// window's build replaying a terminal's session starts as it did.
windowed: bool = platform == .gui,
diff --git a/src/Event.zig b/src/Event.zig
index cc359974..6b2bb8a2 100644
--- a/src/Event.zig
+++ b/src/Event.zig
@@ -146,4 +146,15 @@ pub const Event = union(enum) {
};
/// A view's frontend: what a client of a session elsewhere says it is.
-pub const Frontend = struct { windowed: bool, native_images: bool = false, native_image_patches: bool = false };
+pub const Frontend = struct {
+ windowed: bool,
+ native_images: bool = false,
+ /// The shell can take a changed image a few rows at a time (a texture
+ /// row upload, a shared-memory hand-off), so a PDF selection is
+ /// repainted as it is dragged instead of once on release. Each
+ /// process's own: in no digest and no dump (Pardes.replica.local was
+ /// where it said so).
+ native_image_patches: bool = false,
+
+ pub const replica = .{ .local = .{"native_image_patches"} };
+};
diff --git a/src/Output.zig b/src/Output.zig
index 027502bc..d53ad968 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -985,7 +985,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
.theme_file = pardes.colors.loadedThemeFile(p),
.compiled_default_shell = config.defaultShell(),
.hover_delay_frames = config.look_preview_delay_frames,
- .native_images = p.native_images,
+ .native_images = p.frontend.native_images,
.capabilities = builtins.viewCapabilities(p),
.state = &p.settings,
});
diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig
index 06b96f4b..0131568d 100644
--- a/src/TerminalImages.zig
+++ b/src/TerminalImages.zig
@@ -160,7 +160,7 @@ pub fn draw(
const bottom = pages.getBottomRight(.viewport) orelse return;
const cw: u32 = @max(1, p.cell_pixels.w);
const ch: u32 = @max(1, p.cell_pixels.h);
- const pixels = p.native_images and !ti.petscii;
+ const pixels = p.frontend.native_images and !ti.petscii;
const ctx: Ctx = .{ .ti = ti, .p = p, .s = s, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch, .pixels = pixels };
// Handed on lowest z first (the storage's order is a hash map's), the
// order a shell draws them in; equal z keeps the order they came in.
diff --git a/src/builtins.zig b/src/builtins.zig
index 7a9c2df1..5186ac55 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -42,16 +42,16 @@ const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = fal
pub const capabilities: config.Runtime.Capabilities = if (desktop) window_capabilities else frontend;
/// What the live view's frontend takes: a window's, or a terminal's
-/// (`Pardes.windowed`, which its client says, Event.frontend).
+/// (`Pardes.frontend`, which its client says, Event.frontend).
pub fn viewCapabilities(p: *const Pardes) config.Runtime.Capabilities {
if (comptime !desktop) return frontend;
- return if (p.windowed) window_capabilities else terminal_capabilities;
+ return if (p.frontend.windowed) window_capabilities else terminal_capabilities;
}
/// The live view's frontend, by name (the Settings report's platform).
pub fn viewPlatform(p: *const Pardes) []const u8 {
if (comptime !desktop) return @tagName(pardes.platform);
- return if (p.windowed) "gui" else "tui";
+ return if (p.frontend.windowed) "gui" else "tui";
}
/// Where a builtin acts: at the pane it runs from, or on the editor as a
@@ -183,7 +183,7 @@ pub const registry = struct {
/// cannot show) in a window's view alone. The rest of a build's words are
/// every view's.
pub fn here(p: *const Pardes, b: Builtin()) bool {
- return hereFor(b, viewCapabilities(p), !desktop or p.windowed);
+ return hereFor(b, viewCapabilities(p), !desktop or p.frontend.windowed);
}
/// `here` for a frontend of these capabilities, windowed or not.
diff --git a/src/dump.zig b/src/dump.zig
index faf6fb23..455f172d 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -527,7 +527,7 @@ fn reviveSession(p: *Pardes, previous: ?*Pardes, resumed: bool) !void {
// The host's facts, as this host told them.
p.cell_pixels = old.cell_pixels;
p.row_metrics = old.row_metrics;
- p.native_images = old.native_images;
+ p.frontend.native_images = old.frontend.native_images;
// Its panes close here, each noted where it was, as at its end.
for (old.panes) |slot| if (slot) |pane| old.noteClosed(pane);
p.recent = old.recent.clone(p.recentGpa());
diff --git a/src/edit.zig b/src/edit.zig
index 85718293..8691633c 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -350,7 +350,7 @@ pub fn spanHas(r: i32, c: i32, ar: i32, ac: i32, br: i32, bc: i32) bool {
/// the active modal selection as text, if any
pub fn currentSelText(p: *Pardes, pane: *Pane) ?[]const u8 {
- if (comptime pdf_enabled) if (p.native_images) if (pane.pdf) |pv|
+ if (comptime pdf_enabled) if (p.frontend.native_images) if (pane.pdf) |pv|
if (pv.selection != null and pv.selection_text.len > 0) return pv.selection_text;
if (!pane.body.vsel.active) return null;
return vselText(p, &pane.body);
diff --git a/src/exec.zig b/src/exec.zig
index 3b68a6fd..2f17733f 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -269,7 +269,7 @@ fn heldPane(p: *Pardes, first: usize, k: usize) ?*Pane {
pub fn heldSelection(p: *Pardes, first: usize) ?[]const u8 {
for (0..p.panes.len + 2) |k| {
const t = heldPane(p, first, k) orelse continue;
- if (comptime pdf_enabled) if (p.native_images) if (t.pdf) |pv| {
+ if (comptime pdf_enabled) if (p.frontend.native_images) if (t.pdf) |pv| {
if (pv.selection != null and pv.selection_text.len > 0)
return pv.selection_text;
};
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 99609e5e..d6efa27c 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -1757,9 +1757,9 @@ fn localSession(
defer core.deinit();
g.hit_core = core;
defer g.hit_core = null;
- core.windowed = true;
- core.native_images = true;
- core.native_image_patches = true;
+ core.frontend.windowed = true;
+ core.frontend.native_images = true;
+ core.frontend.native_image_patches = true;
observeGuiFont(g, core);
syncTaglineFont(g, core);
syncLigatures(g, core);
@@ -1895,11 +1895,11 @@ fn localSession(
shell.stopPtys();
clearNativeImages(g);
g.prepared_images.clearRetainingCapacity();
- nc.native_images = true;
- nc.native_image_patches = true;
+ nc.frontend.native_images = true;
+ nc.frontend.native_image_patches = true;
nc.host = host;
if (fs) |f| f.reset(nc);
- nc.windowed = true;
+ nc.frontend.windowed = true;
core.deinit();
core = nc;
frame_probe = &nc.frames; // the old core's ring went with it
@@ -2969,7 +2969,7 @@ fn wheelAt(g: *Gui, in: *Input, w: WheelTurn, mc: MouseCell) void {
};
if (hit) |id| {
const pdf_target = if (comptime pardes.pdf_enabled)
- core.native_images and core.panes[id].?.pdfPage() != null
+ core.frontend.native_images and core.panes[id].?.pdfPage() != null
else
false;
const pane = core.panes[id].?;
diff --git a/src/image.zig b/src/image.zig
index aeb0423a..417cc20e 100644
--- a/src/image.zig
+++ b/src/image.zig
@@ -1054,7 +1054,7 @@ pub fn draw(
) void {
ensureDecoded(p, state);
if (state.rgba.len == 0 or cols == 0 or rows == 0) return;
- if (!state.glyph_art and p.native_images) {
+ if (!state.glyph_art and p.frontend.native_images) {
_ = p.appendImagePlace(.{
.pane = pane_id,
.serial = serial,
diff --git a/src/keys.zig b/src/keys.zig
index dbc31f69..9f16b42a 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -364,7 +364,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
return;
}
edit.pinPaneCursor(p, &pane.body);
- const explicit = (p.native_images and pane.hasPdfSelection()) or
+ const explicit = (p.frontend.native_images and pane.hasPdfSelection()) or
(pane.body.vsel.active and pane.body.vsel.explicit);
if (explicit) {
if (exec.chordEachSel(p, pane, cmd)) return;
diff --git a/src/macos.zig b/src/macos.zig
index d7e9f454..d46f6cd4 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -530,7 +530,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void {
std.mem.eql(u8, std.mem.span(v), "1")
else
@import("pardes_config").workspace_tag;
- core.native_images = true;
+ core.frontend.native_images = true;
var prompt_rcs = host_io.Shell.prepare();
errdefer prompt_rcs.deinit();
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 9c5b82bf..504a4e2d 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -389,7 +389,7 @@ pub fn statusText(p: *Pardes) []const u8 {
// Whether the pointer is over this window: what a grip let go past
// another window's edge asks of every window, to find the one it was
// let go over (Handover.zig), where no window may know another's place.
- if (p.windowed) w.writer.print("pointer {s}\n", .{if (p.pointer_inside) "in" else "out"}) catch {};
+ if (p.frontend.windowed) w.writer.print("pointer {s}\n", .{if (p.pointer_inside) "in" else "out"}) catch {};
return w.written();
}
@@ -1391,11 +1391,11 @@ test "status in a window says whether the pointer is over it" {
// there is a terminal's view.
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
- p.windowed = true;
+ p.frontend.windowed = true;
var lines = std.mem.tokenizeScalar(u8, rd(p, root_status, 0, 4096).bytes, '\n');
for (0..3) |_| _ = lines.next();
try testing.expectEqualStrings("pointer out", lines.next().?);
- p.windowed = false;
+ p.frontend.windowed = false;
}
@@ -1574,9 +1574,9 @@ test "a builtin for one kind of pane is refused on another, and still acts on it
// Petscii chose; with them, what it chose.
for ([_]bool{ false, true }) |art| {
doc.image.?.glyph_art = art;
- p.native_images = false;
+ p.frontend.native_images = false;
try testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(p, doc), " petscii:on ") != null);
- p.native_images = true;
+ p.frontend.native_images = true;
try testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(p, doc), if (art) " petscii:on " else " petscii:off ") != null);
}
}
diff --git a/src/pdf_view.zig b/src/pdf_view.zig
index 8e9c1517..bb960139 100644
--- a/src/pdf_view.zig
+++ b/src/pdf_view.zig
@@ -2329,7 +2329,7 @@ pub fn applyNormal(core: *pardes.Pardes, pane: *pardes.Pane, a: modal.Normal.Act
if (comptime !enabled) return;
const state = pane.pdf orelse return;
const gpa = core.pdf_gpa;
- const native = core.native_images;
+ const native = core.frontend.native_images;
const cells: CellPixels = .{ .w = core.cell_pixels.w, .h = core.cell_pixels.h };
const viewport = paneViewport(core, pane);
const placed = if (native) paneGeometry(core, pane) else null;
@@ -2983,7 +2983,7 @@ pub fn pageAtGridRow(core: *const pardes.Pardes, pane: *const pardes.Pane, row:
/// Some page of the pane is placed where it is drawn.
pub fn paneNativeReady(core: *const pardes.Pardes, pane: *const pardes.Pane) bool {
if (comptime !enabled) return false;
- if (!core.native_images) return false;
+ if (!core.frontend.native_images) return false;
const state = if (pane.pdf) |view| view else return false;
const view = paneViewport(core, pane) orelse return false;
for (state.rasters[0..state.rasters_len]) |*raster| {
@@ -2999,7 +2999,7 @@ pub fn nativePageAtGridRow(
row: u16,
) ?usize {
if (comptime !enabled) return null;
- if (!core.native_images) return null;
+ if (!core.frontend.native_images) return null;
const state = if (pane.pdf) |view| view else return null;
const page = pageAtGridRow(core, pane, row) orelse return null;
const view = paneViewport(core, pane) orelse return null;
@@ -3246,7 +3246,7 @@ pub fn highlightInput(
.hover_page = hover_page,
.hover_color = if (link_hover) core.theme().box else selection_color,
.selection_color = selection_color,
- .live = core.native_image_patches,
+ .live = core.frontend.native_image_patches,
};
}
@@ -3279,7 +3279,7 @@ fn stripAt(state: *State, view: Viewport) f64 {
pub fn verticalWheel(core: *pardes.Pardes, pane: *pardes.Pane, direction: i8) void {
if (comptime !enabled) return;
- if (!core.native_images) {
+ if (!core.frontend.native_images) {
// The text layer: a page a notch.
const state = pane.pdf orelse return;
if (stepPage(state, core.pdf_gpa, direction)) resetPageChrome(pane);
@@ -3293,7 +3293,7 @@ pub fn verticalWheel(core: *pardes.Pardes, pane: *pardes.Pane, direction: i8) vo
pub fn horizontalWheel(core: *pardes.Pardes, pane: *pardes.Pane, direction: i8) void {
if (comptime !enabled) return;
const state = pane.pdf orelse return;
- if (!core.native_images or state.fit != .height) return;
+ if (!core.frontend.native_images or state.fit != .height) return;
const placed = paneGeometry(core, pane) orelse return;
const cols: u32 = @intCast(@max(1, config.wheel_cols));
_ = panPixels(state, placed, .horizontal, direction, scaledStep(core.cell_pixels.w, cols));
@@ -3310,7 +3310,7 @@ pub fn draw(
rail: *pardes.Region,
) bool {
if (comptime !enabled) return false;
- if (!core.native_images or rect.h <= pane.tag_rows) return false;
+ if (!core.frontend.native_images or rect.h <= pane.tag_rows) return false;
const state = pane.pdf orelse return false;
const view = paneViewport(core, pane) orelse return false;
const key = TintKey{ .mode = state.tint, .colors = tintColors(core) };
diff --git a/src/tagline.zig b/src/tagline.zig
index 9655f537..8d65f8c6 100644
--- a/src/tagline.zig
+++ b/src/tagline.zig
@@ -117,7 +117,7 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co
if (comptime pdf_enabled) if (pane.pdf) |pv|
return std.fmt.allocPrint(arena, "{s} [{d}/{d}]", .{ pv.path, pv.page + 1, pv.page_count });
// What is drawn: with no graphics, glyph art whatever `Petscii` says.
- if (pane.image) |*state| return panes.Image.tagPrefix(arena, state, state.glyph_art or !p.native_images);
+ if (pane.image) |*state| return panes.Image.tagPrefix(arena, state, state.glyph_art or !p.frontend.native_images);
// A command pane: its directory, the line it runs, and how that went.
// Its first line only, cut to 48 bytes at a character's start: a tag's
// first row is where the prefix ends, and a line that ran over to a
@@ -151,7 +151,7 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co
// A terminal showing kitty graphics says how it draws them, as an image
// pane does, and so does one drawing them as glyph art by choice.
if (panes.terminal.petscii(pane)) |chosen| {
- const on = chosen or !p.native_images;
+ const on = chosen or !p.frontend.native_images;
if (chosen or panes.terminal.hasImages(pane))
return std.fmt.allocPrint(arena, "{s} petscii:{s}", .{ (try shownDir(arena, pane)), if (on) "on" else "off" });
}
diff --git a/src/tape.zig b/src/tape.zig
index c76fd445..1c58e886 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -170,7 +170,7 @@ pub const shape = blk: {
};
/// Fields a host writes straight into the core between its calls.
-const watched = .{ "native_images", "native_image_patches", "present_skipped", "needs_frame", "quit", "windowed", "active", "unattended" };
+const watched = .{ "frontend", "present_skipped", "needs_frame", "quit", "active", "unattended" };
const Kind = enum(u8) { input, done, host, ret, set, digest };
/// A digest record's kind byte (replica.zig reads a unit's last).
diff --git a/src/terminal.zig b/src/terminal.zig
index 22371a78..6f9e2071 100644
--- a/src/terminal.zig
+++ b/src/terminal.zig
@@ -3219,7 +3219,7 @@ test "a terminal's kitty graphics image is drawn where its program placed it, an
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
p.active = 0;
p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } });
var frame = std.heap.ArenaAllocator.init(gpa);
@@ -3278,7 +3278,7 @@ test "ED 3 takes away a kitty placement whose row it erased: it never comes back
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } });
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -3345,7 +3345,7 @@ test "a virtual kitty placement shows through its placeholder cells, which draw
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 });
defer p.deinit();
- p.native_images = true;
+ p.frontend.native_images = true;
p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } });
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -3397,7 +3397,7 @@ test "without pixels, or by the Petscii builtin, a terminal's image is glyph art
}.check;
// A shell that draws no pixels (a tty under no kitty graphics): forced.
- p.native_images = false;
+ p.frontend.native_images = false;
var s = try p.render(frame.allocator());
try std.testing.expectEqual(@as(usize, 0), imagePlaces(s).len);
try std.testing.expect(painted(s.at(tx, y)) and painted(s.at(tx + 1, y)));
@@ -3407,7 +3407,7 @@ test "without pixels, or by the Petscii builtin, a terminal's image is glyph art
// Pixels where they can be drawn; the builtin flips the pane to glyphs
// and back.
- p.native_images = true;
+ p.frontend.native_images = true;
_ = frame.reset(.retain_capacity);
s = try p.render(frame.allocator());
try std.testing.expectEqual(@as(usize, 1), imagePlaces(s).len);
diff --git a/src/tui/tui.zig b/src/tui/tui.zig
index 1e4b238e..e8a5c44c 100644
--- a/src/tui/tui.zig
+++ b/src/tui/tui.zig
@@ -1090,7 +1090,7 @@ test "host watch closes initial race and reloads rename-over PDF while idle" {
}
try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "reloaded") != null);
- core.native_images = true;
+ core.frontend.native_images = true;
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
const surface = try core.render(frame.allocator());
@@ -1115,7 +1115,7 @@ const PdfWheelTarget = struct { pane: usize, page: usize };
fn nativePdfWheelTarget(core: *const pardes.Pardes, mouse: vaxis.Mouse) ?PdfWheelTarget {
if (comptime !pardes.pdf_enabled) return null;
- if (!core.native_images or mouse.type != .press or
+ if (!core.frontend.native_images or mouse.type != .press or
(mouse.button != .wheel_up and mouse.button != .wheel_down) or
mouse.col < 0 or mouse.row < 0) return null;
const col: u16 = @intCast(mouse.col);
@@ -1750,7 +1750,7 @@ fn localSession(
sh.from = 0;
if (live.on) startInput(loop, live) catch {};
if (live.on) clearNativeImages(&live.kitty, &live.vx, &live.tty);
- nc.native_images = live.on and live.vx.caps.kitty_graphics;
+ nc.frontend.native_images = live.on and live.vx.caps.kitty_graphics;
nc.unattended = !live.on;
sh.peers.alone_unattended = !live.on;
if (fs) |f| f.reset(nc);
@@ -2002,7 +2002,7 @@ const Shell = struct {
const screen = s.term() orelse return;
stopInput(s.io, &screen.thread);
screen.leave();
- s.core.native_images = false;
+ s.core.frontend.native_images = false;
s.setAttended(false);
// The stub's stdin, stdout and stderr were its terminal too.
const null_fd = libc.open("/dev/null", .{ .ACCMODE = .RDWR, .CLOEXEC = true }, @as(libc.mode_t, 0));
@@ -2596,11 +2596,11 @@ const Shell = struct {
};
const sc = s.term() orelse return;
- s.core.native_image_patches = sc.feed.shm.load(.acquire);
+ s.core.frontend.native_image_patches = sc.feed.shm.load(.acquire);
if (sc.caps_pending and sc.on and sc.vx.queries_done.load(.unordered)) {
sc.caps_pending = false;
sc.vx.enableDetectedFeatures(sc.tty.writer()) catch {};
- s.core.native_images = sc.vx.caps.kitty_graphics;
+ s.core.frontend.native_images = sc.vx.caps.kitty_graphics;
if (sc.vx.caps.kitty_graphics) kittyShmProbe(sc.tty.writer(), &sc.feed);
sc.vx.queueRefresh();
s.core.needs_frame = true;
diff --git a/src/views.zig b/src/views.zig
index dff25af6..d598e2fc 100644
--- a/src/views.zig
+++ b/src/views.zig
@@ -37,7 +37,7 @@ pub const fields = [_][:0]const u8{
"col_x", "col_w", "active",
"jumps",
"active_column",
- "native_images", "native_image_patches", "windowed",
+ "frontend",
"drag", "mouse_grab", "window_focused", "focus_told",
"hover_col", "hover_row", "pointer_raw_col", "pointer_raw_row",
"pointer_body_hit", "pointer_tag_hit", "raw_hover_intent", "pointer_inside",
@@ -434,7 +434,7 @@ pub fn open(p: *Pardes) ?u8 {
};
const slot = p.parked[k].?;
slot.* = .{ .view = .{ .screen_w = p.screen_w, .screen_h = p.screen_h } };
- inline for (sized ++ laid_out ++ .{ "windowed", "native_images", "native_image_patches" }) |name|
+ inline for (sized ++ laid_out ++ .{"frontend"}) |name|
@field(slot.view, name) = @field(p, name);
// A query's mark on the jumps is the view's that asked it.
slot.view.jumps.force = false;