# `MingaEditor.SemanticWindow`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/semantic_window.ex#L1)

Pre-resolved semantic rendering data for one editor window.

This struct captures everything a GUI frontend needs to render a buffer
window without interpreting TUI cell-grid commands. The BEAM resolves
all layout (word wrap, folding, virtual text splicing, conceal ranges)
and all styling (syntax highlighting, selection, search matches) before
populating this struct.

The struct is built alongside the existing `WindowFrame` draws in the
Content stage. In Phase 2 of the gui_window_content work (#828), the
Emit stage will encode this struct as opcode 0x80 for GUI frontends.

## Design Principles

1. **BEAM is the single source of truth.** Swift never computes word wrap,
   fold resolution, or display column offsets. Everything is pre-resolved.

2. **Display coordinates everywhere.** All positions (cursor, selection,
   search matches, diagnostics) use display row/column, not buffer
   line/byte-col. This means virtual text displacement, fold collapsing,
   and wrap breaks are already accounted for.

3. **Composed text.** Each visual row carries the final UTF-8 text that
   should be rendered, with inline virtual text already spliced and
   conceal ranges already applied.

4. **Overlay data separate from spans.** Selection and search matches are
   sent as coordinate ranges, not baked into span colors. This lets the
   GUI render them as Metal quads (zero re-rasterization on selection
   change).

# `cursor_shape`

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

# `t`

```elixir
@type t() :: %MingaEditor.SemanticWindow{
  annotations: [MingaEditor.SemanticWindow.ResolvedAnnotation.t()],
  cursor_col: non_neg_integer(),
  cursor_row: non_neg_integer(),
  cursor_shape: cursor_shape(),
  cursor_visible: boolean(),
  diagnostic_ranges: [MingaEditor.SemanticWindow.DiagnosticRange.t()],
  document_highlights: [MingaEditor.SemanticWindow.DocumentHighlightRange.t()],
  full_refresh: boolean(),
  rows: [MingaEditor.SemanticWindow.VisualRow.t()],
  scroll_left: non_neg_integer(),
  search_matches: [MingaEditor.SemanticWindow.SearchMatch.t()],
  selection: MingaEditor.SemanticWindow.Selection.t() | nil,
  window_id: pos_integer()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
