pub struct LiveInput<'a> {
pub caret_and_selection: Option<&'a Highlight>,
pub live: Option<&'a LiveState<'a>>,
pub substitute: Option<Substitute<'a>>,
pub appearance_state: Option<&'a [u8]>,
}Expand description
What a form session shows a widget it is editing, beyond the widget’s own dictionary.
Three borrows that travel together because the live path needs all three
to draw one field: the overlay it paints, the text it paints instead of
the stored /V, and the second face for the characters the /DA font
cannot write. A record rather than three more parameters, so a fourth
answer can be added without moving anyone’s call.
Default is “a field with nothing live about it”, which
generate_with_live_faces renders exactly as generate_with_text
does with no substitute.
Adding a field to this struct breaks every exhaustive literal outside
this crate. #[non_exhaustive] is NOT the fix: it forbids the literal form
entirely outside the crate, ..Default::default() included (E0639),
and the two external callers (pdfrum-form::route,
pdfrum-tool::chrome) legitimately build the whole value. Before a
fourth field lands, give it a constructor — LiveInput::new() plus
with_* setters — and convert those two sites; that keeps additions
source-compatible without taking literal construction away.
Fields§
§caret_and_selection: Option<&'a Highlight>The focused-field caret and selection bands.
live: Option<&'a LiveState<'a>>What the session is showing in place of the stored /V, /I and
/TI.
substitute: Option<Substitute<'a>>The second face, for characters the /DA font’s charset does not
cover. None leaves every character to the /DA font, which is
what a Hebrew value being typed into a Latin field used to get: the
low byte of each code point, drawn as Latin.
appearance_state: Option<&'a [u8]>The appearance state a session is showing, overriding the widget
dictionary’s own /AS. None reads /AS as before, byte for byte.
§Why a session cannot say this through /AS
A radio group is one field with several kid controls, and each kid
carries a different on-state name in its own /AP /N. Checking one
sets the clicked control’s /AS to that control’s own on-state and
every other control’s to Off — so one click restates the state of
every kid in the group, in as many different names.
A session holds one state record per field, so all it can say is
which control the click chose. Turning that into what each kid draws is
per-kid, and the widget dictionary on disk still names the state before
the click. This is how the session tells the generator which kid to
draw off — the value it passes being Off for a sibling and the
control’s own on-state for the chosen one.
Only the on/off question is overridden, not the state’s name: what
the generator does with it is is_checked_with’s single comparison
against Off, so any non-Off bytes draw the on-state shape.