# `Minga.Buffer.Cursor`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/buffer/cursor.ex#L1)

Moves the document cursor while preserving valid editor caret positions.

# `direction`

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

# `move`

```elixir
@spec move(Minga.Buffer.Document.t(), direction()) :: Minga.Buffer.Document.t()
```

Moves the cursor one move in the requested direction.

# `next_character`

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

Returns the character immediately after a caret.

# `place`

```elixir
@spec place(Minga.Buffer.Document.t(), Minga.Buffer.Document.position()) ::
  Minga.Buffer.Document.t()
```

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

# `previous_character`

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

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

---

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