A buffer-level fold region decoration: a collapsible range with a custom placeholder.
Unlike per-window folds (managed by FoldMap), decoration folds are
per-buffer. Every window showing the buffer sees the same fold state.
This is the right model for agent chat thinking blocks, tool output,
and other decoration-driven collapsible content.
The placeholder callback receives the fold's start line, end line,
and available width, and returns styled segments for the summary line
shown when the fold is closed.
Summary
Functions
Returns true if the given buffer line is within this fold (start inclusive, end inclusive).
Returns the number of lines hidden when this fold is closed.
Returns true if the given buffer line is hidden by this closed fold.
Types
@type placeholder_fn() :: (non_neg_integer(), non_neg_integer(), pos_integer() -> [{String.t(), Minga.Core.Face.t()}]) | nil
Placeholder render callback for a closed fold region.
Receives (start_line, end_line, width) and returns styled segments. When nil, the default placeholder "··· N lines" is used.
@type t() :: %Minga.Core.Decorations.FoldRegion{ closed: boolean(), end_line: non_neg_integer(), group: term() | nil, id: reference(), placeholder: placeholder_fn(), start_line: non_neg_integer() }
Functions
@spec contains?(t(), non_neg_integer()) :: boolean()
Returns true if the given buffer line is within this fold (start inclusive, end inclusive).
@spec hides?(t(), non_neg_integer()) :: boolean()
Returns true if the given buffer line is hidden by this closed fold.