Raxol.Terminal.CharacterHandling (Raxol v0.2.0)
View SourceHandles wide character and bidirectional text support for the terminal emulator.
This module provides functions for:
- Determining character width (single, double, or variable width)
- Handling bidirectional text rendering
- Managing character combining
- Supporting Unicode character properties
Summary
Functions
Determines the bidirectional character type. Returns :LTR, :RTL, :NEUTRAL, or :COMBINING.
Gets the width of a character in terminal cells. Returns 1 for narrow characters, 2 for wide characters.
Gets the effective width of a string, taking into account wide characters.
Determines if a character is a combining character.
Determines if a character is a wide character (takes up two cells).
Processes a string for bidirectional text rendering. Returns a list of segments with their rendering order.
Splits a string at a given width, respecting wide characters.
Functions
Determines the bidirectional character type. Returns :LTR, :RTL, :NEUTRAL, or :COMBINING.
@spec get_char_width(String.t()) :: 0 | 1 | 2
Gets the width of a character in terminal cells. Returns 1 for narrow characters, 2 for wide characters.
@spec get_string_width(String.t()) :: non_neg_integer()
Gets the effective width of a string, taking into account wide characters.
Determines if a character is a combining character.
Determines if a character is a wide character (takes up two cells).
Processes a string for bidirectional text rendering. Returns a list of segments with their rendering order.
@spec split_at_width(String.t(), non_neg_integer()) :: {String.t(), String.t()}
Splits a string at a given width, respecting wide characters.