Skip to main content

Module wrapcache

Module wrapcache 

Source
Expand description

Shared line/wrap-structure cache backing both the Request JSON and Response panels’ rendering and their text selection.

A panel’s underlying text (an HTTP response body, a JSON request preview) is split once into raw (unwrapped) lines and their wrapped-row extents — not on every redraw — so scrolling/dragging a selection over an “obscenely large” body costs only what’s on screen, never the whole body (see rebuild_if_needed/visible_window). The same structure also converts between screen space (a wrapped row/col, valid only for the current frame’s scroll + panel width) and logical space (a raw line index + character offset, stable across resizes/rewraps/rescrolls) — which is what lets a selection survive a panel resize by staying on the same characters instead of the same terminal coordinates.

Structs§

PanelWrap
Cached line/wrap structure for one panel’s text, rebuilt only when its content or width actually changes (see PanelWrap::rebuild_if_needed).
TextPos
A position in a panel’s logical (unwrapped) text: which raw line (0-based), and which character offset within it (0-based; may equal the line’s own length to mean “just past its last character”). Deliberately never a screen/terminal coordinate, so it stays valid across rewraps.
WrapMarker
A purely-visual end-of-row marker drawn in a reserved rightmost column on every continued wrapped row (a row that a raw line wrapped past — i.e. not the last row of that line), so a soft wrap is visually distinct from a real line break. Opt-in via [SelectablePanel::set_wrap_marker] / PanelWrap’s builders; only meaningful in WrapMode::Wrap.
WraperMarkerBuilder
Builder struct for WrapMarker

Enums§

WrapMode
How a panel lays out raw lines wider than its inner width.