Minga.RenderModel.Window (Minga v0.1.0)

Copy Markdown View Source

Canonical visible model for one buffer-like window.

The Content stage builds this model from current-frame data. Frontend adapters encode it for GUI or composite it into cells for TUI proof-of-concept paths. The struct is pure data and lives in core so products can produce window content without importing MingaEditor.

contiguous_rows is a BEAM-internal hint (never encoded on the wire): it is true only for the non-wrapped, non-folded sequential path, where rows are consecutive :normal buffer lines. It lets ScrollPresentation derive the resident line range by arithmetic instead of folding over every row.

content_digest is a BEAM-internal, never-encoded incremental fingerprint of the row set (Minga.RenderModel.Window.ContentDigest), set only on the full-document residence path. When present, the GUI adapter's content frame-emit gate uses it instead of hashing the whole rows list, so an edit-frame gate is O(changed rows) rather than O(document). It is nil off the residence path, where the adapter keeps hashing rows directly.

scroll_seq is the monotonic scroll-authority sequence (#2661) encoded onto ScrollPresentation. It advances when the committed viewport top changes for a reason other than an echoed frontend scroll report, or when an authoritative viewport-jump command explicitly marked the window even though the top was unchanged (#2652); see MingaEditor.Window.settle_scroll_seq/1. Frontends discard their local offset on any increase, so a BEAM-initiated jump racing a local scroll is distinguished from the frontend's own reported delta being reflected back.

Summary

Types

content_kind()

@type content_kind() :: :buffer | :agent_chat | :agent_prompt | :empty

cursor_shape()

@type cursor_shape() :: :block | :beam | :underline

rect()

@type rect() ::
  {row :: non_neg_integer(), col :: non_neg_integer(),
   width :: non_neg_integer(), height :: non_neg_integer()}

t()

@type t() :: %Minga.RenderModel.Window{
  annotations: [Minga.RenderModel.Window.Annotation.t()],
  content_digest: Minga.RenderModel.Window.ContentDigest.t() | nil,
  content_epoch: non_neg_integer(),
  content_kind: content_kind(),
  contiguous_rows: boolean(),
  cursor_col: non_neg_integer(),
  cursor_row: non_neg_integer(),
  cursor_shape: cursor_shape(),
  cursor_visible: boolean(),
  cursorline: Minga.RenderModel.Window.Cursorline.t() | nil,
  diagnostic_ranges: [Minga.RenderModel.Window.DiagnosticRange.t()],
  document_highlights: [Minga.RenderModel.Window.DocumentHighlight.t()],
  full_refresh: boolean(),
  geometry: Minga.RenderModel.Window.PaneGeometry.t() | nil,
  gutter: Minga.RenderModel.Window.Gutter.t() | nil,
  indent_guides: Minga.RenderModel.Window.IndentGuides.t() | nil,
  rect: rect(),
  row_delta: Minga.RenderModel.Window.RowDelta.t() | nil,
  rows: [Minga.RenderModel.Window.Row.t()],
  scroll_left: non_neg_integer(),
  scroll_seq: non_neg_integer(),
  search_matches: [Minga.RenderModel.Window.SearchMatch.t()],
  selection: Minga.RenderModel.Window.Selection.t() | nil,
  window_id: pos_integer()
}