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

Cursor line flash after large jumps.

Briefly highlights the landing line with a brighter background after
the cursor moves more than a configurable threshold. The flash fades
in steps from a bright highlight back to the normal cursorline tint
(or editor bg if cursorline is disabled).

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.

# `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.NavFlash{
  line: non_neg_integer(),
  max_steps: pos_integer(),
  step: non_neg_integer(),
  timer: reference() | nil
}
```

Flash state: nil when inactive, struct when flashing.

# `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.

Returns an empty list for nil input.

# `color_for_step`

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

Computes the flash background color for the current step.

Interpolates between `flash_bg` (step 0) and `target_bg` (final step)
linearly. `target_bg` is the cursorline bg if cursorline is enabled,
or the editor bg otherwise.

# `start`

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

Creates a new flash struct for the given line.

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*
