Minga.Buffer.Span (Minga v0.1.0)

Copy Markdown View Source

Represents a resolved half-open span in document text.

Most editor code should talk in positions and selections. A span is the internal resolved shape used once a selection is ready to read or edit text.

Summary

Functions

Builds a span from two document points.

Builds a characterwise span that includes the character at the final point.

Removes the text covered by a span.

Returns the text covered by a span.

Types

point()

@type point() :: Minga.Buffer.Position.point()

t()

@type t() :: %Minga.Buffer.Span{start: point(), stop: point()}

Functions

between(start_point, stop_point)

@spec between(point(), point()) :: t()

Builds a span from two document points.

characterwise(text, start_point, stop_point)

@spec characterwise(String.t(), point(), point()) :: t()

Builds a characterwise span that includes the character at the final point.

delete(text, span)

@spec delete(String.t(), t()) :: String.t()

Removes the text covered by a span.

slice(text, span)

@spec slice(String.t(), t()) :: String.t()

Returns the text covered by a span.