MingaEditor.RenderModel.Window.Builder (Minga v0.1.0)

Copy Markdown View Source

Builds a RenderWindow from the same data the Content stage uses.

Called during build_window_content/2 when the frontend has GUI capabilities. Captures the pre-resolved semantic data that the GUI needs, without duplicating the draw logic.

The builder reads from:

  • WindowScroll (viewport, lines, cursor, fold map, visible_line_map)
  • Context.t() (visual selection, search matches, highlight, decorations)
  • Buffer diagnostics (for inline ranges)

All positions are converted to display coordinates (relative to the window's content rect, with fold/wrap adjustments applied).

Summary

Functions

Builds a RenderWindow for one editor window.

Builds a RenderWindow and reports retained-row statistics (#2287).

Returns the source buffer position for a click in wrapped composed rows.

Types

build_stats()

state()

Functions

build(state, scroll, ctx, opts \\ [])

Builds a RenderWindow for one editor window.

Called from the Content stage with the same WindowScroll and Context that drive the draw-based rendering.

build_with_stats(state, scroll, ctx, opts \\ [])

Builds a RenderWindow and reports retained-row statistics (#2287).

Identical output to build/4 but also returns how many rows were freshly rasterized and the retained-row map to carry into the next frame. Pass the previous frame's retained rows via the :retained_rows option so unchanged rows are reused verbatim instead of being recomposed.

wrapped_source_position(lines, first_line, visual_row, display_col, ctx, options)

@spec wrapped_source_position(
  [String.t()],
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  MingaEditor.Renderer.Context.t(),
  map()
) :: {:ok, non_neg_integer(), non_neg_integer()} | :error

Returns the source buffer position for a click in wrapped composed rows.