Count display characters after removing ANSI SGR escapes.

SolidGroundUX DocumentationSolidGroundUX
NL

fn: sgnd_visible_length

Purpose

Count display characters after removing ANSI SGR escapes.

Arguments

  • $1 — Text, potentially containing ANSI styling.

Output

Writes the count to stdout.

Returns

  • 0 after counting.

Usage

  sgnd_visible_length "$colored_text"