# `MingaEditor.Mouse`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/mouse.ex#L1)

Mouse event handling for the editor.

Handles scroll, click, drag, and release events, translating screen
coordinates to buffer positions. All functions are pure `state -> state`
transformations; the buffer is mutated via `Buffer` calls, but the
GenServer state struct is returned unchanged or updated.

## Multi-click selection

* Double-click: select word under cursor, enter Visual mode
* Triple-click: select entire line, enter Visual Line mode
* Double-click + drag: extend selection word-by-word
* Triple-click + drag: extend selection line-by-line

## Modifier clicks

* Shift+click: extend visual selection to click position
* Cmd/Super+click: go-to-definition (when LSP active)
* Middle-click: paste at click position

## Horizontal scroll

* Wheel left/right: shift viewport horizontally

# `state`

```elixir
@type state() :: MingaEditor.State.t()
```

Internal editor state.

# `handle`

```elixir
@spec handle(
  state(),
  integer(),
  integer(),
  atom(),
  non_neg_integer(),
  atom(),
  pos_integer()
) :: state()
```

Dispatches a mouse event, returning updated state.

# `handle_at_node`

```elixir
@spec handle_at_node(
  state(),
  MingaEditor.FocusTree.Node.t(),
  integer(),
  integer(),
  atom(),
  non_neg_integer(),
  atom(),
  pos_integer()
) :: state()
```

Dispatches a mouse event routed to a focus-tree node.

---

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