Display-width helpers for use with the :display-width layout option.
Display-width helpers for use with the :display-width layout option.
(ansi-width value)Returns the display width of value after removing ANSI escape sequences.
Use as :display-width width/ansi-width for colored terminal output where SGR
color/style codes should not count as visible columns.
Returns the display width of value after removing ANSI escape sequences. Use as `:display-width width/ansi-width` for colored terminal output where SGR color/style codes should not count as visible columns.
(codepoint-width codepoint)Returns a terminal-style display width for one Unicode code point.
Control, combining, enclosing, spacing-combining, and format code points are treated as zero-width. East Asian wide/fullwidth code points are treated as two columns. Other code points are treated as one column.
Returns a terminal-style display width for one Unicode code point. Control, combining, enclosing, spacing-combining, and format code points are treated as zero-width. East Asian wide/fullwidth code points are treated as two columns. Other code points are treated as one column.
(strip-ansi value)Removes ANSI escape sequences from value and returns a string.
This covers common CSI color/style sequences, OSC sequences such as terminal hyperlinks, and single-byte ESC sequences. It does not interpret Unicode grapheme width; use a Unicode-aware width function when wide glyphs are present.
Removes ANSI escape sequences from value and returns a string. This covers common CSI color/style sequences, OSC sequences such as terminal hyperlinks, and single-byte ESC sequences. It does not interpret Unicode grapheme width; use a Unicode-aware width function when wide glyphs are present.
(terminal-width value)Returns Unicode display width after removing ANSI escape sequences.
Use as :display-width width/terminal-width when terminal output may contain
both ANSI styling and wide Unicode glyphs.
Returns Unicode display width after removing ANSI escape sequences. Use as `:display-width width/terminal-width` when terminal output may contain both ANSI styling and wide Unicode glyphs.
(unicode-width value)Returns a terminal-style display width for Unicode text.
This is a code-point based helper for common monospace terminal output. It handles combining marks and East Asian wide/fullwidth characters, but does not attempt full grapheme-cluster shaping for emoji ZWJ sequences.
Returns a terminal-style display width for Unicode text. This is a code-point based helper for common monospace terminal output. It handles combining marks and East Asian wide/fullwidth characters, but does not attempt full grapheme-cluster shaping for emoji ZWJ sequences.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |