Skip to main content

Crate hjkl_hover

Crate hjkl_hover 

Source
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§

HoverAnchor
Cursor cell that the popup is anchored to.
HoverRect
On-screen bounding rect returned by position.
HoverState
All state needed to display and manage a hover popup.
HoverViewport
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.