Drafter.Render.RowDamage (drafter v0.5.0)

Copy Markdown View Source

Which cells of a terminal row changed since it was last written, as runs to rewrite instead of the whole row.

Drafter.Render.RowDamage.runs(previous_strip, strip)
#=> [{4, 3}, {40, 12}]

A run is {first_column, width}. Runs closer than :gap columns apart (default 4) are joined, since rewriting a few unchanged cells costs less than moving the cursor again. Where the runs would cover more than :whole of the row (default 0.6), or the two rows differ in width, the answer is :whole and the row is written as it is. A wide character is never split: a run that would start or end inside one takes all of it.

Summary

Functions

The runs that changed from previous to current, [] when none did, or :whole.

Types

run()

@type run() :: {non_neg_integer(), pos_integer()}

Functions

runs(previous, current, opts \\ [])

@spec runs(Drafter.Draw.Strip.t(), Drafter.Draw.Strip.t(), keyword()) ::
  [run()] | :whole

The runs that changed from previous to current, [] when none did, or :whole.