Minga.Buffer.Cursor (Minga v0.1.0)

Copy Markdown View Source

Moves the document cursor while preserving valid editor caret positions.

Summary

Functions

Moves the cursor one move in the requested direction.

Returns the character immediately after a caret.

Places the cursor at the nearest valid caret position for the requested editor position.

Splits the character immediately before a caret from the preceding text.

Types

direction()

@type direction() :: :left | :right | :up | :down

Functions

move(doc, atom)

Moves the cursor one move in the requested direction.

next_character(text)

@spec next_character(String.t()) :: {String.t(), String.t()} | nil

Returns the character immediately after a caret.

place(doc, arg)

Places the cursor at the nearest valid caret position for the requested editor position.

previous_character(text)

@spec previous_character(String.t()) :: {String.t(), String.t()}

Splits the character immediately before a caret from the preceding text.