Mouse interaction state: drag tracking, anchor position, separator resize, multi-click detection, and hover tracking.
Multi-click detection
The TUI always sends click_count: 1 because libvaxis doesn't track
multi-clicks. The BEAM detects double/triple-clicks by comparing press
timestamps and positions. GUI frontends send the native click count
directly, so BEAM detection is skipped when click_count > 1.
Two presses within @double_click_ms milliseconds at the same position
(within @click_distance cells) increment the click count. The count
resets on motion, timeout, or a click at a different position.
Summary
Functions
Records a mouse press and computes the effective click count.
Begins a content drag from the given buffer position.
Begins a content drag from the given buffer position and originating window.
Types
@type clicks() :: :idle | {:pressed, %{time: integer(), pos: {integer(), integer()}, count: pos_integer()}}
@type drag() :: :idle | {:active, %{ anchor: {non_neg_integer(), non_neg_integer()}, origin_window: MingaEditor.Window.id() | nil, click_count: pos_integer() }}
@type resize() :: :idle | {:active, {MingaEditor.WindowTree.direction() | :agent_separator, non_neg_integer()}}
Functions
@spec active_drag(t()) :: {:active, {non_neg_integer(), non_neg_integer()}, MingaEditor.Window.id() | nil, pos_integer()} | :idle
@spec click_count(t()) :: non_neg_integer()
@spec double_click_ms() :: pos_integer()
@spec hover_delay_ms() :: pos_integer()
@spec record_press(t(), integer(), integer(), pos_integer()) :: t()
Records a mouse press and computes the effective click count.
If native_click_count > 1, uses that directly (GUI frontend).
Otherwise, detects multi-clicks by timing and position (TUI fallback).
Returns the updated mouse state with the effective click count set.
@spec start_drag( t(), {non_neg_integer(), non_neg_integer()} ) :: t()
Begins a content drag from the given buffer position.
@spec start_drag( t(), {non_neg_integer(), non_neg_integer()}, MingaEditor.Window.id() | nil ) :: t()
Begins a content drag from the given buffer position and originating window.
@spec start_resize( t(), MingaEditor.WindowTree.direction() | :agent_separator, non_neg_integer() ) :: t()
@spec update_resize( t(), MingaEditor.WindowTree.direction() | :agent_separator, non_neg_integer() ) :: t()