pub fn popup_outer_size(
buffer_width: u16,
buffer_height: u16,
line_count: u16,
placement: PopupPlacement,
) -> (u16, u16)Expand description
Outer size (border-inclusive) of a help / hover popup overlay.
Centred popups are reading surfaces (:help, :options,
:describe-*, :apropos, :customize); they want enough
room to lay out paragraphs + tables comfortably without
covering the whole screen. The buffer below stays partly
visible so the user keeps spatial context. Caps:
- Width:
min(buffer_width - 4, 120), floor 30. The 120-cell ceiling preserves a comfortable line length for reading markdown – wider lines are harder to scan, so even on a 200-cell terminal the popup stops at 120. - Height:
buffer_height * 3 / 4, floor 5, no upper ceiling. Three-quarters leaves a strip of the underlying buffer visible at top and bottom while giving a large help doc all the vertical room the screen allows; anything longer than the box scrolls within the popup.
Cursor-anchored popups are tooltips (hover, signature help); they sit adjacent to the cursor and want to not dominate the screen. Caps stay tight: width 30..=80, height 5..=20.
line_count is the popup’s content row count
(excluding borders). The returned (width, height) is
border-inclusive (height = inner + 2); subtract 2 to get
the inner viewport for motion / scroll.