package matrix

  1. Overview
  2. Docs
Fast, modern terminal toolkit for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.1.0.tbz
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9

doc/matrix.ansi/Ansi/Writer/index.html

Module Ansi.WriterSource

Byte buffer writers.

Byte buffer writers for escape sequence emission.

A writer wraps a Stdlib.Bytes.t buffer and manages a write position. Writers are mutable and not thread-safe: use one writer per thread.

Writers

Sourcetype t

The type for byte buffer writers.

Sourceval make : bytes -> t

make buf is a writer targeting buf. The buffer must be large enough to contain all generated output; no bounds checking is performed.

Sourceval make_counting : unit -> t

make_counting () is a writer that tracks output length without writing any bytes. Useful for measuring escape sequence sizes before allocating a buffer.

Inspection

Sourceval len : t -> int

len w is the number of bytes written so far.

Sourceval pos : t -> int

pos w is the current write position. Same as len.

Sourceval reset_pos : t -> unit

reset_pos w resets the write position to zero. The underlying buffer is not cleared.

Sourceval slice : t -> bytes

slice w is a fresh copy of the bytes written so far.

Writing

Sourceval write_char : t -> char -> unit

write_char w c appends character c. In counting mode, increments the position without writing.

Sourceval write_string : t -> string -> unit

write_string w s appends string s.

Sourceval write_subbytes : t -> bytes -> int -> int -> unit

write_subbytes w buf off len appends len bytes from buf starting at offset off.