blob: 4f6c1d525501b5e19faee7cf1a17b7ee8d29b85e (
plain)
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
|
use fmt;
use io;
use unix::tty;
export type tui = struct {
out: io::file,
clear: bool,
};
export fn init() (tui | tty::error) = {
const f = tty::open()?;
doclear(f);
return tui {
out = f,
clear = false,
};
};
fn doclear(out: io::file) void = {
fmt::fprint(out, "\x1B[2J\x1B[1;1H")!;
};
export fn clear(state: *tui) void = {
state.clear = true;
//fmt::fprint(out, "\x1B[2J\x1B[1;1H")!;
};
export fn finish(state: *tui) void = {
io::close(state.out)!;
};
|