summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:31:38 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:28 -0300
commit7d359addc420eca66bd1583d8fd8d6a104986a03 (patch)
tree2b8991a9a4e5b9c16a2b7683018d60c7c6985c1e /src/edit.zig
parent96cabca7ebe287692ebdff0dba6bb2897eba9d3e (diff)
downloadpardes-7d359addc420eca66bd1583d8fd8d6a104986a03.tar.gz
pardes-7d359addc420eca66bd1583d8fd8d6a104986a03.zip
panes: a pane's PDF state is its own allocation, `pdf: ?*Pdf.State` (made by openPane with pdf_gpa, freed by deinitPane), as a terminal's is, where every Pane held the State inline, a text file's and a terminal's too: a Pane is 49232 bytes where it was 88936 (the State 39704), and a replica's rollback copy of a pane without a PDF is that much smaller; the dump and the wire change with it, the walk writing the slot as a pointer to a State where it wrote the State in place, so a dump written before this, or a peer of an older build, gives its PDF panes no PDF (the walk notes `Pane.pdf: its kind changed; its default taken`, and dump.ensureKind makes each a terminal); the 97 uses change form only (a `|*x|` capture or a `&` dropped, normal.zig's one among them), applyNormal untouched
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/edit.zig b/src/edit.zig
index 85ace33f..2ba6d57a 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -182,7 +182,7 @@ fn pasteInto(p: *Pardes, t: *Text, bytes: []const u8) void {
}
pub fn clipYank(p: *Pardes, pane: *Pane, main_only: bool) void {
- if (comptime pdf_enabled) if (pane.pdf) |*pv| {
+ if (comptime pdf_enabled) if (pane.pdf) |pv| {
if (pv.selection_text.len > 0) setClipboard(p, pv.selection_text);
return;
};
@@ -360,7 +360,7 @@ pub fn spanHas(r: i32, c: i32, ar: i32, ac: i32, br: i32, bc: i32) bool {
/// the active modal selection as text (v range or x lines), 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.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 vselText(p, &pane.body);
if (!pane.body.msel.active) return null;
@@ -401,7 +401,7 @@ pub fn paneCursorLines(p: *Pardes, t: *Text) ![]const []const u8 {
const pane = t.pane() orelse return &.{};
if (pane.file) |*f| return panes.File.cursorLines(arena, pane, f);
if (pane.hasPdf()) {
- if (comptime pdf_enabled) return panes.Pdf.textLines(&pane.pdf.?, p.pdf_gpa, arena);
+ if (comptime pdf_enabled) return panes.Pdf.textLines(pane.pdf.?, p.pdf_gpa, arena);
unreachable;
}
return panes.terminal.cursorLines(p, pane);