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
|
// If set, enable extended grapheme cluster support (see
// [[termbox2::extend_cell]] and [[termbox2::set_cell_ex]]). Consumes more
// memory. Defaults on.
export def OPT_EGC: bool = false;
// A cell in a 2d grid representing the terminal screen.
//
// The terminal screen is represented as a 2d array of cells. The structure is
// optimized for dealing with single-width (wcwidth==1) Unicode codepoints,
// however some support for grapheme clusters (e.g., combining diacritical
// marks) and wide codepoints (e.g., Hiragana) is provided through ech via
// [[termbox2::set_cell_ex]]. ech is only valid if it is non-empty, otherwise
// ch is used.
//
// For non-single-width codepoints, given W=wcwidth(ch || ech):
//
// - when W<=0: termbox forces a single-width cell. Callers should avoid this
// if aiming to render text accurately. Callers may use
// [[termbox2::set_cell_ex]] or [[termbox2::print]] or similar to render
// W==0 combining characters.
// - when W>=2: termbox zeroes out the following W-1 cells and skips
// sending them to the tty. So, e.g., if the caller sets x=0,y=0 to a
// W==2 codepoint, the caller's next set should be at x=2,y=0. Anything
// set at x=1,y=0 will be ignored. If there are not enough columns
// remaining on th eline to render W cells, spaces are sent instead.
export type cell = struct {
ch: u32, // a Unicode codepoint
fg: uattr, // bitwise foreground attributes
bg: uattr, // bitwise background attributes
};
|