MingaEditor.Mouse (Minga v0.1.0)

Copy Markdown View Source

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

Summary

Types

Internal editor state.

Functions

Dispatches a mouse event, returning updated state.

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

Types

state()

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

Internal editor state.

Functions

handle(state, row, col, arg4, mods, arg6, cc)

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

Dispatches a mouse event, returning updated state.

handle_at_node(state, node, row, col, button, mods, event_type, click_count)

@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.