use fmt; use unix::tty; use io; export type coords = (u16, u16); export type printfn = fn(w: *widget) void; export type resizefn = fn(w: *widget, ttysize: tty::ttysize) void; export type nosize = void; export type widgetsize = (tty::ttysize | nosize); export type widget = struct { out: io::file, print: *printfn, resize: *resizefn, pos: coords, sz: widgetsize, }; def gotoroot: str = "\x1B[1;1f"; export fn print(out: io::file, s: str, pos: coords) void = { fmt::fprintf(out, "\x1B[{};{}H", pos.0, pos.1)!; fmt::fprint(out, s)!; };