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

Yank region flash after a yank operation.

Briefly highlights the yanked region with a bright background that
fades back to the editor background over several steps, providing
visual confirmation of what was copied (like Neovim's YankHighlight).

This is a pure calculation module. It returns structs and side-effect
instructions (`{:send_after, msg, interval}`, `{:cancel_timer, ref}`).
The Editor GenServer executes the side effects.

# `position`

```elixir
@type position() :: {non_neg_integer(), non_neg_integer()}
```

Position as `{line, col}`.

# `range_type`

```elixir
@type range_type() :: :charwise | :linewise
```

Whether the yanked region is charwise or linewise.

# `side_effect`

```elixir
@type side_effect() ::
  {:send_after, atom(), pos_integer()} | {:cancel_timer, reference()}
```

Side-effect instruction returned to the caller.

# `t`

```elixir
@type t() :: %MingaEditor.YankFlash{
  buf: pid(),
  end_pos: position(),
  max_steps: pos_integer(),
  range_type: range_type(),
  start_pos: position(),
  step: non_neg_integer(),
  timer: reference() | nil
}
```

Active yank flash state tracking the highlighted region and animation progress.

# `advance`

```elixir
@spec advance(t()) :: {:continue, t(), [side_effect()]} | :done
```

Advances the flash to the next step.

Returns `{:continue, updated_flash, side_effects}` if more steps
remain, or `:done` if the flash is complete.

# `cancel_effects`

```elixir
@spec cancel_effects(t() | nil) :: [side_effect()]
```

Returns side effects needed to cancel an active flash.

# `color_for_step`

```elixir
@spec color_for_step(t(), non_neg_integer(), non_neg_integer()) :: non_neg_integer()
```

# `default_flash_bg`

```elixir
@spec default_flash_bg() :: non_neg_integer()
```

Computes the flash background color for the current step.

Interpolates between `flash_bg` (step 0) and `target_bg` (final step)
linearly.

# `flash_group`

```elixir
@spec flash_group() :: atom()
```

# `highlight_bounds`

```elixir
@spec highlight_bounds(pid(), position(), position(), range_type()) ::
  {position(), position()}
```

Computes the highlight bounds for the flash decoration.

Charwise ranges pass through unchanged. Linewise ranges expand to
full line width using the buffer's line content.

# `start`

```elixir
@spec start(pid(), position(), position(), range_type(), reference() | nil) ::
  {t(), [side_effect()]}
```

Creates a new yank flash for the given buffer and range.

Returns `{flash, side_effects}`. The caller must execute the side
effects (cancel old timer, schedule new one).

---

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