Opal::VisualWidth
Utilities for computing string display width in terminal columns, accounting for ANSI escapes, East Asian wide characters, and Unicode emojis.
Constants
ANSI_REGEX = /\e\[[0-9;?]*[a-zA-Z]|\e\].*?(?:\a|\e\\)/
Class methods
Returns the visual column width of a character when printed on a terminal.
Truncates a string to fit within max_width terminal columns, appending ellipsis if needed.