Skip to main content

Crate pdfboss_tui

Crate pdfboss_tui 

Source
Expand description

Interactive terminal explorer for PDF internals, implemented from ISO 32000 on top of pdfboss-aio’s async document model.

State machine (app), pane models (tree, inspector, hexview, preview, markdown, search), key mapping (input) and rendering (ui) are pure and unit-testable; only run touches the terminal. The event loop tokio::select!s over the crossterm event stream, a background-task message channel and a 100 ms tick, so long operations (element streaming, hex fetches, search, preview rasterization) never block input.

Modules§

app
The application state machine. update consumes Msgs (input, ticks, background-task completions) and returns Cmds (side effects for the event loop to execute); no I/O happens here, which keeps the whole TUI testable without a terminal.
clipboard
Clipboard transport for the yank menu: the native clipboard via arboard, falling back to the OSC 52 escape sequence (which reaches the local clipboard even over SSH, but cannot confirm delivery).
hexview
Hex pane: hexyl-style offset │ hex │ ascii lines with byte-class colors, windowed fetching over a span, and objstm-member highlighting.
input
Key-event → intent mapping. Pure so bindings are unit-testable.
inspector
Inspector pane: the selected element pretty-printed, with d cycling raw bytes / decoded bytes / disassembled content operators for streams, and a cursor over N G R references for Enter-to-jump.
markdown
Markdown preview: the per-page Markdown extraction as scrollable text. This module is pure state plus a line-oriented styling pass; the extraction itself runs off the event loop.
preview
Page preview: a rasterized page painted with half-blocks — the upper pixel of each terminal cell is the foreground color, the lower pixel the background color, two vertical pixels per cell. Rendering happens off the event loop; this module is pure state and math.
search
Incremental object search: case-insensitive matching over object numbers, dict keys, name values and string contents. Results stream in from a background task tagged with a generation; stale generations are dropped here.
tree
Tree pane: lazy hierarchy over a document’s elements.
ui
Rendering: pure layout math here plus the pane painters.
yank
Yank menu: copy the selection as a q expression, shell command, hexdump, raw bytes, pretty value, or object reference.

Functions§

run
Runs the explorer until the user quits. doc supplies all data (file- or HTTP-backed); title labels the status bar; target is the path or URL as given, used verbatim in yanked shell commands. Document-level errors become status-bar toasts; only terminal I/O errors are returned.