UI module

visible_lines

procedureextensionexperimentalsince 0.31.0Source

The visible rows of an editor as (first line, last line, line height), from its last layout.

Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
ui := headless();
defer free_ui(*ui);
node := find_role(*ui, .TEXT_EDITOR);
first, last, line_height := visible_lines(*ui, *edit, node, .{});

This one is only checked to compile, not run.

visible_lines :: (
    ui: *UI_State,
    edit: *Text_Edit,
    node: *Node,
    options: Editor_Options
) -> (first: int, last: int, line_height: float)

The visible rows of an editor as (first line, last line, line height), from its last layout.

Parameters

ui: *UI_State
the UI whose text system measures the lines.
edit: *Text_Edit
the text being edited.
node: *Node
the editor's node, whose height says how much fits.
options: Editor_Options
the editor's font and size.

Returns

first: int
last: int
line_height: float
Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
ui := headless();
defer free_ui(*ui);
node := find_role(*ui, .TEXT_EDITOR);
first, last, line_height := visible_lines(*ui, *edit, node, .{});

This one is only checked to compile, not run.

See also