From 8facd769003b970e7a2c933f1887e09bffb4bd08 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 21:37:08 -0300 Subject: kinds #46, the docs say pdf is Zig over MuPDF: reference.typ's Addons section (the module's init and held body, pdf.zig through pdf_bridge.c, its jobs, one place shown by each view, the text layer's lines and the glide), shared-libs.md (the library and the static build), the changelog Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/shared-libs.md | 9 +++++---- docs/typ/reference.typ | 23 ++++++++++++++--------- src/CHANGELOG.md | 8 ++++++++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/docs/shared-libs.md b/docs/shared-libs.md index 4a07f80a..b9f64fdf 100644 --- a/docs/shared-libs.md +++ b/docs/shared-libs.md @@ -34,16 +34,17 @@ tests); `-Dmupdf` is gone. `zig build static -Dplatform=tui -Dtarget=x86_64-linux-musl` links the terminal binary statically (musl: glibc links only dynamically) with both addons compiled in: image.zig as a module, its stb_image static in stb.c -beside the binary's zstbi resize, and pdf.c with MuPDF, its FreeType and -zlib, its export renamed (`-Dpardes_addon=pardes_addon_pdf`), so the -binary holds one copy of each. Addon.zig registers both at start as if +beside the binary's zstbi resize, and pdf.zig with MuPDF, its FreeType and +zlib (the module exports `pardes_addon` only from its library, so the static +binary reads its declaration), so the binary holds one copy of each. Addon.zig registers both at start as if loaded. It loads no library (a static binary has no dlopen); it is also the way a build for macOS, whose loader has no memfd, could have image and PDF panes. ## PDF panes became an addon (2026-11-06) -`lib/pardes/addons/pdf.so` (addons/pdf/pdf.c and pdf_bridge.c) holds MuPDF, +`lib/pardes/addons/pdf.so` (addons/pdf/pdf.zig, in Zig, over MuPDF through +the C of pdf_bridge.c, since 2026-11-07) holds MuPDF, built against the build's FreeType and zlib and linked into the library with them, all three compiled position-independent; it exports `pardes_addon` alone (a version script), so its FreeType and zlib never diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 22065cd1..db9cdb54 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -988,21 +988,26 @@ wrapping every function of the header and every call of `pa_api`: the pane's arena and pardes's heap as `std.mem.Allocator`s, typed keys, clicks and views, a window to `put` text in (column first, where the header's `pa_put` is row first), a deadline for `tick`, a `prefix` written after -every tick, a struct's bytes as its record, and its own `zig test` (`zig +every tick, a body written (at most 4 KiB) or held (any length), an `init` +at load, a struct's bytes as its record, and its own `zig test` (`zig build addon-test` runs them); a Zig kind outside the tree runs `zig translate-c src/kinds/pardes_addon.h` once for the header: `addons/snake/snake.zig` is a game in it. Pictures are an addon too, `addons/image/image.zig` (PNG, JPEG, GIF, BMP, PPM, PGM and TGA through stb_image, at most 1280 pixels a side), which `zig build image` installs as `/lib/pardes/addons/image.so`, and so are PDFs, -`addons/pdf/pdf.c` over MuPDF (its pages rendered on jobs, two at once), -which `zig build pdf` installs as `/lib/pardes/addons/pdf.so` -(`zig build addons`, both); without them an image file and a PDF open as -text. A -PDF on a terminal without graphics shows its page's text layer, the moving -keys and the wheel a page a step; with them its pages, a fast scroll -rendering only the rows each page shows until it rests, a touchpad's turn -moving it by its fraction of a row, and the pointer a hand over a link. +`addons/pdf/pdf.zig`, in Zig over MuPDF through `pdf_bridge.c` (C, so +MuPDF's throws stay in C; its pages, their sizes, a page's text and a +search on jobs, two at once), which `zig build pdf` installs as +`/lib/pardes/addons/pdf.so` (`zig build addons`, both); without +them an image file and a PDF open as text. A PDF is one place, its page and +how far down it, shown by each view its own way. On a terminal without +graphics it shows its page's text layer from the line the place names, the +moving keys a page a step, the wheel, `gj`, `gk`, `Ctrl-e` and +`Ctrl-y` a line and a page at the window's edge; with them its pages, +a wheel's notch gliding there over four frames, a fast scroll rendering +only the rows each page shows until it rests, a touchpad's turn moving it +by its fraction of a row at once, and the pointer a hand over a link. The header is ABI 3.0: an addon built against another major (a 2.x one) is refused. A kind's state is one thing, stepped by `tick` however many views (windows and terminals on the session) show it; what each view sees diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index b5568686..07c72846 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +- The PDF addon is Zig (`addons/pdf/pdf.zig`, over MuPDF through + `pdf_bridge.c`): each view of a PDF has its own layout of the one place + (a terminal's text layer and a window's pages at once), its search, its + page's text and its pages' sizes are jobs, a search's rows stream into + its `+Search` and a stale one is cancelled. On a terminal without + graphics the wheel, `gj`, `gk`, `Ctrl-e` and `Ctrl-y` scroll the page's + text a line, and turn the page at the window's edge; with graphics a + wheel's notch glides there over four frames. - `Build` prints this build into a `+Build` pane: version, commit, jj change and build time (stamped builds), the zig, mode, target, platform, grammars, whether the addons are compiled in, and the dependencies. -- cgit v1.3