Expand description
Renderer-agnostic hover popup state and geometry.
Handles HoverState, anchor/viewport types, position math (with
above/below overflow flip), and keyboard-driven scroll. No rendering
types are referenced — the TUI adapter lives in hjkl-hover-tui.
§Quick start
use hjkl_hover::{HoverAnchor, HoverState, HoverViewport, position};
use std::time::Instant;
let state = HoverState::new("hello world".to_string(), HoverAnchor::new(5, 3));
let vp = HoverViewport::new(80, 24);
let rect = position(&state, vp);
assert!(rect.x + rect.width <= 80);
assert!(rect.y + rect.height <= 24);Structs§
- Hover
Anchor - Cursor cell that the popup is anchored to.
- Hover
Rect - On-screen bounding rect returned by
position. - Hover
State - All state needed to display and manage a hover popup.
- Hover
Viewport - Available terminal area for popup placement.
Constants§
- DEFAULT_
MAX_ HEIGHT - Maximum popup height (content rows + 2 border).
- DEFAULT_
MAX_ WIDTH - Maximum popup width (content columns + 2 border).
- HOVER_
AUTO_ FADE - Duration before a stationary hover popup is automatically dismissed.
Functions§
- position
- Compute the on-screen bounding rect for a popup.