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/src/miaou-driver-matrix.driver/matrix_cell.ml.html

Source file matrix_cell.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2025 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(*****************************************************************************)

type style = {
  fg : int;
  bg : int;
  bold : bool;
  dim : bool;
  underline : bool;
  reverse : bool;
  url : string;
}

type t = {mutable char : string; mutable style : style}

let default_style =
  {
    fg = -1;
    bg = -1;
    bold = false;
    dim = false;
    underline = false;
    reverse = false;
    url = "";
  }

let empty () = {char = " "; style = default_style}

let create ~char ~style = {char; style}

let copy cell = {char = cell.char; style = cell.style}

let reset cell =
  cell.char <- " " ;
  cell.style <- default_style

(* Invalidate a cell so it never equals any valid cell - used for force redraw *)
let invalidate cell =
  cell.char <- "\x00" ;
  cell.style <- default_style

let style_equal a b =
  a.fg = b.fg && a.bg = b.bg && a.bold = b.bold && a.dim = b.dim
  && a.underline = b.underline && a.reverse = b.reverse
  && String.equal a.url b.url

let equal a b = a.char = b.char && style_equal a.style b.style

let is_empty cell = cell.char = " " && style_equal cell.style default_style