mdv-minus
mdv-minus 5.7.2 is the mdv-maintained fork of minus 5.7.2 from the upstream v5.7.2 tag. It remains available under the original MIT/Apache-2.0 license, and its library target intentionally keeps the minus name.
Depend on the fork under that library name:
= { = "mdv-minus", = "5.7.2" }
mdv adds a typed prompt-rendering API:
Pager::set_prompt_rendererinstalls a renderer receiving a stable, read-onlyPromptContext.Pager::clear_prompt_rendererrestores the built-in prompt without recreating the pager.PromptLine,PromptSpan,PromptStyle,PromptColor, andPromptAttributeprovide left/right alignment, Unicode-aware truncation, padding, colors, attributes, and a final style reset without exposing ANSI construction to callers.Pager::set_prompt_panelandPager::clear_prompt_panelmanage styled lines below the status prompt; panel rows reduce the content viewport and preserve bottom anchoring when toggled.Pager::set_search_promptreplaces the/or?search prefix with validated single-line text, whilePager::clear_search_promptrestores the directional default. Search input is drawn on the reserved status row even when a prompt panel is visible.Pager::send_message_fordisplays a message for a fixed duration and uses a generation ID so an older timer cannot clear a newer message.PagerState::selected_textreturns the active visible selection without ANSI or OSC control sequences, allowing custom input classifiers to choose between selection-aware and whole-document actions.PromptContext::content_rowsreports the usable content height,PromptContext::panel_rowsexposes the currently reserved panel height, andPromptContext::max_scroll_offsetshares the pager's canonical scroll bound.PromptSpanrejects line breaks and terminal control characters. Base-prompt and message setters now report line breaks throughResultinstead of panicking while preserving their legacy ANSI-capable surface; the search-prefix setter follows the same single-line contract.- Changing the base prompt while a renderer is active updates
PromptContext::prompt; clearing the renderer later reveals that latest base prompt. - The prompt is regenerated after vertical or horizontal scrolling, appends, resize/reformat operations, temporary messages, and renderer lifecycle changes.
- Prompt-panel scrolling uses synchronized full redraws so terminal scroll commands cannot move panel fragments into the document viewport.
- Entering search pauses the general event reader before the search command is queued, keeping search cancellation keys inside the search input loop.
- Search input restores and selects the last query draft. Escape closes the prompt while preserving its current text even without confirmation; Backspace or Delete removes the selected query, cursor movement collapses the selection for ordinary editing, and a manually cleared query is not restored later. Shifted characters are accepted, and editing uses Unicode character positions instead of UTF-8 byte offsets. Outside the input prompt, Escape clears active highlights while retaining the query for reuse; only the next Escape exits.
- Mouse selection maps terminal display cells to ANSI-free Unicode text coordinates, converts horizontal byte offsets back to character offsets, keeps complete grapheme clusters intact, redraws only changed rows inside a synchronized terminal update, and remains highlighted after mouse release.
- The fixed mdv selection palette (
#8F93A2on#1F2233) overrides embedded SGR colors and attributes while selected, then restores the original style at the selection boundary. dynamic_paging_in_placeruns the same dynamic pager without entering or leaving a terminal screen buffer, allowing callers that already own an alternate screen to hand it over without exposing the underlying terminal.- Default navigation adds
b/ffor full-page movement and state-awareEsc, uses the panel-aware content height for full- and half-page movement, maps Space to single-line down, and mapsCtrl+Fto forward search. The Space andCtrl+Faliases stay out of mdv's help panel.
The renderer runs synchronously while the pager state is locked. Implementations must remain fast, non-blocking, and free of terminal I/O.
The fork adds direct unicode-segmentation and unicode-width dependencies for grapheme-safe prompt layout and selection geometry.
The extension exists because upstream minus 5.7.2 hardcodes its prompt colors and does not expose a dynamic status-line renderer.