MingaEditor.Shell.Traditional.YankFlash (Minga v0.1.0)

Copy Markdown View Source

Pure lifecycle owner for the yank-region flash animation.

Summary

Functions

Returns whether a yank flash is active.

Advances a matching generation, rejecting stale timer delivery.

Cancels the active yank flash while retaining its generation.

Computes the current animation color.

Returns the fallback yank flash color.

Returns the decoration group owned by the yank flash workflow.

Computes charwise or linewise highlight bounds from workflow-provided line length.

Records a timer handle only for the current active generation.

Replaces the active yank flash and advances its monotonic generation.

Returns the animation interval used by the workflow.

Types

generation()

@type generation() :: non_neg_integer()

position()

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

range_type()

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

t()

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

Functions

active?(yank_flash)

@spec active?(t()) :: boolean()

Returns whether a yank flash is active.

advance(flash, generation)

@spec advance(t(), generation()) :: {:continue, t()} | {:done, t()} | {:stale, t()}

Advances a matching generation, rejecting stale timer delivery.

cancel(flash)

@spec cancel(t()) :: t()

Cancels the active yank flash while retaining its generation.

color_for_step(yank_flash, flash_bg, target_bg)

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

Computes the current animation color.

default_flash_bg()

@spec default_flash_bg() :: non_neg_integer()

Returns the fallback yank flash color.

flash_group()

@spec flash_group() :: atom()

Returns the decoration group owned by the yank flash workflow.

highlight_bounds(start_pos, end_pos, atom, end_line_length)

@spec highlight_bounds(position(), position(), range_type(), non_neg_integer()) ::
  {position(), position()}

Computes charwise or linewise highlight bounds from workflow-provided line length.

record_timer(flash, generation, timer)

@spec record_timer(t(), generation(), reference()) :: t()

Records a timer handle only for the current active generation.

replace(flash, buf, start_pos, end_pos, range_type)

@spec replace(t(), pid(), position(), position(), range_type()) :: t()

Replaces the active yank flash and advances its monotonic generation.

step_interval_ms()

@spec step_interval_ms() :: pos_integer()

Returns the animation interval used by the workflow.