package miaou-driver-matrix

  1. Overview
  2. Docs
Miaou high-performance terminal driver with diff rendering

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.5.2.tar.gz
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 (ESC38;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'
Sourcetype t

Parser state, maintains current style across parse calls.

Sourceval create : unit -> t

Create a new parser with default style.

Sourceval reset : t -> unit

Reset parser to initial state (default style).

Sourceval current_style : t -> Matrix_cell.style

Get the current style being applied by the parser.

Sourceval parse_into : t -> Matrix_buffer.t -> row:int -> col:int -> string -> int * int

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.

Sourceval parse_line : t -> Matrix_buffer.t -> row:int -> col:int -> string -> int

Parse a single line (no newline handling) into buffer. Returns the column after last character.

Sourceval parse_into_batch : t -> Matrix_buffer.batch_ops -> row:int -> col:int -> string -> int * int

Parse into buffer using batch_ops for thread-safe access. Use within Matrix_buffer.with_back_buffer.

Sourceval parse_to_cells : t -> string -> (string * Matrix_cell.style) list

Parse string and return list of (char, style) pairs for inspection. Useful for testing. Does not write to buffer.

Sourceval visible_length : string -> int

Count visible characters in an ANSI string (excluding escape sequences).