MingaEditor.Renderer.Context (Minga v0.1.0)

Copy Markdown View Source

Rendering context for a single render pass.

Bundles the per-frame invariants that every line renderer needs: viewport geometry, visual selection bounds, search match positions, gutter width, and the active substitute-confirm match (if any).

Built once per render call and threaded through the line rendering pipeline, keeping individual function signatures focused on the per-line values that actually vary (line text, screen row, buffer line).

Summary

Types

t()

Represents the bounds of a visual selection for rendering.

Functions

Returns the context with a different decoration set.

Types

t()

@type t() :: %MingaEditor.Renderer.Context{
  confirm_match: Minga.Editing.Search.Match.t() | nil,
  content_w: pos_integer(),
  cursor_col: non_neg_integer(),
  cursor_line: non_neg_integer() | nil,
  cursorline_bg: MingaEditor.UI.Theme.color() | nil,
  decorations: Minga.Core.Decorations.t(),
  diagnostic_signs: %{
    required(non_neg_integer()) => Minga.Diagnostics.Diagnostic.severity()
  },
  document_highlight_colors: term(),
  editor_bg: MingaEditor.UI.Theme.color(),
  fold_ranges: [term()],
  git_colors: MingaEditor.UI.Theme.Git.t(),
  git_signs: %{required(non_neg_integer()) => Minga.Core.Diff.hunk_type()},
  gutter_colors: MingaEditor.UI.Theme.Gutter.t(),
  gutter_w: non_neg_integer(),
  has_sign_column: boolean(),
  highlight: MingaEditor.UI.Highlight.t() | nil,
  hl_todo_faces: %{required(atom()) => Minga.Core.Face.t()},
  hover_row: non_neg_integer() | nil,
  indent_guide_active_face: Minga.Core.Face.t() | nil,
  indent_guide_face: Minga.Core.Face.t() | nil,
  line_number_style: atom(),
  nav_flash: MingaEditor.NavFlash.t() | nil,
  nav_flash_bg: MingaEditor.UI.Theme.color() | nil,
  search_colors: MingaEditor.UI.Theme.Search.t() | nil,
  search_matches: [Minga.Editing.Search.Match.t()],
  show_invisible: boolean(),
  tab_width: pos_integer(),
  viewport: MingaEditor.Viewport.t(),
  visual_selection: visual_selection(),
  whitespace_face: Minga.Core.Face.t() | nil,
  width_oracle: Minga.Core.WidthOracle.t(),
  wrap_on: boolean()
}

visual_selection()

@type visual_selection() ::
  nil
  | {:char, {non_neg_integer(), non_neg_integer()},
     {non_neg_integer(), non_neg_integer()}}
  | {:line, non_neg_integer(), non_neg_integer()}

Represents the bounds of a visual selection for rendering.

  • nil — no active selection
  • {:char, start_pos, end_pos} — characterwise selection
  • {:line, start_line, end_line} — linewise selection

Functions

with_decorations(ctx, decorations)

@spec with_decorations(t(), Minga.Core.Decorations.t()) :: t()

Returns the context with a different decoration set.