NavigableContent adapter for Buffer.Document snapshots.
Wraps a Document.t() and a Scroll.t() into a single struct that
implements both NavigableContent and Readable. This is the bridge
between the Buffer domain (gap buffer, byte-indexed columns, undo
stack) and the universal editing model (protocol-based commands).
Usage
# Take a snapshot from a running Buffer.Server
doc = Buffer.Server.snapshot(server)
snapshot = BufferSnapshot.new(doc, scroll)
# Commands operate on the snapshot
pos = Motion.word_forward(snapshot, NavigableContent.cursor(snapshot))
snapshot = NavigableContent.set_cursor(snapshot, pos)
# Apply the result back
Buffer.Server.apply_snapshot(server, snapshot.document)Coordinate system
Columns are byte offsets, matching Document's convention. This is
consistent with tree-sitter and the Zig renderer. Use
Document.grapheme_col/2 when you need display column widths.
Summary
Functions
Creates a new BufferSnapshot from a Document and optional Scroll state.
Types
@type t() :: %Minga.Editing.NavigableContent.BufferSnapshot{ document: Minga.Buffer.Document.t(), scroll: Minga.Editing.Scroll.t() }
A Document snapshot with scroll state for NavigableContent.
Functions
@spec new(Minga.Buffer.Document.t()) :: t()
Creates a new BufferSnapshot from a Document and optional Scroll state.
@spec new(Minga.Buffer.Document.t(), Minga.Editing.Scroll.t()) :: t()