package miaou-driver-matrix
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=60a3b9f181f24572a06a9492532bfdda
sha512=fcc35a275066be2900e6201782faf47503076fa4640f08cf78067835a6f447b74613009e55b2ac799adb7ca46f1bffa261fc5971753f2cc3c6bef327511c7ef6
doc/miaou-driver-matrix.driver/Miaou_driver_matrix/Matrix_ansi_parser/index.html
Module Miaou_driver_matrix.Matrix_ansi_parserSource
ANSI escape sequence parser for the Matrix driver.
Parses ANSI-formatted strings (as produced by MIAOU widgets) into cell buffers. Handles:
- 256-color foreground/background (ESC
38;5;Nm, ESC[48;5;Nm) - Basic colors (ESC[30-37m, ESC[40-47m) - Bold, dim, underline, reverse - Reset (ESC[0m) - UTF-8 characters including multi-byte State Machine: - Normal: reading visible characters - EscapeStart: saw ESC (\027) - CSI: saw ESC[, accumulating parameters until 'm'
Parser state, maintains current style across parse calls.
Get the current style being applied by the parser.
Parse an ANSI string into the buffer starting at (row, col). Returns the (row, col) after the last written character. Handles newlines by advancing row and resetting col to 0.
Parse a single line (no newline handling) into buffer. Returns the column after last character.
val parse_into_batch :
t ->
Matrix_buffer.batch_ops ->
row:int ->
col:int ->
string ->
int * intParse into buffer using batch_ops for thread-safe access. Use within Matrix_buffer.with_back_buffer.
Parse string and return list of (char, style) pairs for inspection. Useful for testing. Does not write to buffer.
Count visible characters in an ANSI string (excluding escape sequences).