Skip to main content

Crate neco_editor_viewport

Crate neco_editor_viewport 

Source
Expand description

Viewport geometry calculations for editor rendering.

Pure geometry: converts between byte offsets, logical/visual lines, and pixel coordinates. No DOM or Canvas dependency.

Structs§

Rect
Axis-aligned rectangle in pixel coordinates.
ViewportLayout
Computed layout measurements.
ViewportMetrics
Host-injected font metrics. Plain struct (parameter bag).
VisualLineFrame

Enums§

ViewportError
Errors returned by viewport operations.

Functions§

caret_rect
Compute the pixel rectangle for the caret at offset.
caret_rect_with_width_policy
gutter_width
Compute the line-number gutter width for total_lines lines.
hit_test
Convert a click at pixel (x, y) to a byte offset in text.
hit_test_with_width_policy
line_top
Return the Y pixel coordinate for the top of visual_line.
scroll_to_reveal
Compute a new scroll_top that reveals the caret at offset, or None if already visible.
selection_rects
Compute the pixel rectangles that cover selection.
selection_rects_with_width_policy
visible_line_range
Returns (first_visual_line, last_visual_line) visible in the viewport.
visual_line_frame