#[non_exhaustive]pub struct HoverState {
pub content: String,
pub anchor: HoverAnchor,
pub dismissed: bool,
pub scroll: usize,
pub displayed_at: Instant,
pub expiry: Option<Instant>,
pub max_width: u16,
pub max_height: u16,
}Expand description
All state needed to display and manage a hover popup.
#[non_exhaustive] — new fields may be added in minor releases.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: StringRaw markdown (or plain-text) hover content as returned by the LSP.
anchor: HoverAnchorTerminal cell the popup is anchored to.
dismissed: boolWhether the popup has been explicitly dismissed.
scroll: usizeScroll offset: number of content lines scrolled past the top.
displayed_at: InstantWhen the popup was first shown — used for auto-fade.
expiry: Option<Instant>Optional hard expiry override (overrides the default 8-second auto-fade).
max_width: u16Maximum popup width in terminal columns (including border).
max_height: u16Maximum popup height in terminal rows (including border).
Implementations§
Source§impl HoverState
impl HoverState
Sourcepub fn new(content: String, anchor: HoverAnchor) -> Self
pub fn new(content: String, anchor: HoverAnchor) -> Self
Create a new popup anchored at anchor with default size limits.
Sourcepub fn is_expired(&self, now: Instant) -> bool
pub fn is_expired(&self, now: Instant) -> bool
Returns true when the popup has expired (now past the deadline).
Sourcepub fn scroll_lines(&mut self, n: isize)
pub fn scroll_lines(&mut self, n: isize)
Scroll the popup by n lines (positive = down, negative = up).
Clamped to [0, line_count - 1]. The lower bound stops back-scroll at
the top; the upper bound stops the model value from running away past
the content (which would make an equal number of up-presses do nothing
before the popup visibly moves). The renderer still clamps further
against the actual viewport height.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Number of non-empty content lines (for scroll clamping in the renderer).