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

Copy Markdown View Source

Internal retained visual-row entry for semantic window builds.

Summary

Types

t()

@type t() :: %MingaEditor.RenderModel.Window.VisualRow{
  buf_line: non_neg_integer(),
  composed_end_utf16: non_neg_integer(),
  composed_start_utf16: non_neg_integer(),
  display_row: non_neg_integer(),
  indent_width: non_neg_integer(),
  input_hash: non_neg_integer() | nil,
  reused?: boolean(),
  row: Minga.RenderModel.Window.Row.t(),
  row_width: non_neg_integer(),
  source_end_byte: non_neg_integer(),
  source_end_col: non_neg_integer(),
  source_offset_map: MingaEditor.RenderModel.Window.SourceOffsetMap.t(),
  source_start_byte: non_neg_integer(),
  source_start_col: non_neg_integer(),
  source_text: String.t(),
  visual_index: non_neg_integer(),
  wrap_line_hash: non_neg_integer() | nil
}

Functions

new(row, source_offset_map, source_start_col, source_end_col, indent_width)

reposition(entry, buf_line)

@spec reposition(t(), non_neg_integer()) :: t()

retained_row(visual_row)

reused?(visual_row)

@spec reused?(t()) :: boolean()

source_character_position(entry, row_local_utf16)

@spec source_character_position(t(), non_neg_integer()) ::
  {:ok, {non_neg_integer(), non_neg_integer()}} | :not_source_backed

Resolves a modal pointer target to a character in the displayed row.

A hit at or beyond the row end targets its final composed grapheme, so a soft-wrap boundary does not select the next row's first character. The source map preserves Unicode grapheme boundaries, replacement ranges, and virtual-text anchors. Empty and non-source rows retain their existing boundary behavior.

source_position(entry, row_local_utf16)

@spec source_position(t(), non_neg_integer()) ::
  {:ok, {non_neg_integer(), non_neg_integer()}} | :not_source_backed

Resolves a row-local composed UTF-16 boundary to a source position.

Wrap indentation resolves to the row's first source byte. Offsets past the rendered row resolve to its final source byte. Inline virtual text resolves to its anchor, and fold-summary text resolves to source end-of-line.

source_position(entry, row_local_utf16, affinity)

@spec source_position(
  t(),
  non_neg_integer(),
  MingaEditor.RenderModel.Window.SourceOffsetMap.affinity()
) ::
  {:ok, {non_neg_integer(), non_neg_integer()}} | :not_source_backed

Resolves a row-local composed UTF-16 boundary with explicit affinity.

Inside replacement text or a grapheme's UTF-16 range, :start chooses the preceding source boundary and :end chooses the following source boundary.

with_display_row(entry, display_row)

@spec with_display_row(t(), non_neg_integer()) :: t()

with_retention(entry, input_hash, reused?)

@spec with_retention(t(), non_neg_integer(), boolean()) :: t()

with_wrap_line_hash(entry, wrap_line_hash)

@spec with_wrap_line_hash(t(), non_neg_integer()) :: t()