Raxol.Terminal.Bounds (Raxol Terminal v2.6.1)

Copy Markdown View Source

Shared coordinate-clamping helpers for terminal cursor and buffer modules.

Internal to raxol_terminal; not part of the package's supported public API.

Summary

Functions

Clamps value into the valid index range [0, dimension - 1].

Functions

clamp_to_bounds(value, dimension)

@spec clamp_to_bounds(integer(), integer()) :: non_neg_integer()

Clamps value into the valid index range [0, dimension - 1].

Equivalent to max(0, min(value, dimension - 1)). dimension is a terminal width or height (a count of cells); the returned index is the last addressable cell when value overflows and 0 when it underflows.