diff options
Diffstat (limited to 'tui/widget/widget.ha')
| -rw-r--r-- | tui/widget/widget.ha | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/tui/widget/widget.ha b/tui/widget/widget.ha index 39b77ba..f7dc511 100644 --- a/tui/widget/widget.ha +++ b/tui/widget/widget.ha @@ -72,14 +72,10 @@ export type color = enum uint { export type style = struct { border: bool, - colorfg: color, - colorbg: color, }; export def DEFAULT_STYLE: style = style { border = false, - colorfg = color::DEFAULTFG, - colorbg = color::DEFAULTBG, }; export def NEWLINE: str = "\r\n"; @@ -133,7 +129,14 @@ fn minrows(out: io::file, x: u16, y: widgetsize) (u16 | tty::error) = { }; // Must free return string -fn color_to_str(color: color) str = fmt::asprintf("\x1B[{}m", strconv::utos(color)); +export fn color_to_str(color: color) str = fmt::asprintf("\x1B[{}m", strconv::utos(color)); +//{ +// const cu = match (color) { +// case let c: colorfg => yield c: uint; +// case let c: colorbg => yield c: uint; +// }; +// return +//}; fn clearrow(row: uint) str = fmt::asprintf("\x1B[{}d{}", row, CLEARROW); @@ -208,17 +211,17 @@ fn applystyles(st: (*style | void), s: []str) []str = { yield strings::dupall(s); }; //defer strings::freeall(sborder); - const scolor = color_to_str(st.colorfg); - defer free(scolor); - const defcolor = color_to_str(color::DEFAULTFG); - defer free(defcolor); - const sb = strings::concat(scolor, sborder[0]); - free(sborder[0]); - sborder[0] = sb; - const endidx = len(sborder) - 1; - const sb = strings::concat(sborder[endidx], defcolor); - free(sborder[endidx]); - sborder[endidx] = sb; + //const scolor = color_to_str(st.colorfg); + //defer free(scolor); + //const defcolor = color_to_str(colorfg::DEFAULTFG); + //defer free(defcolor); + //const sb = strings::concat(scolor, sborder[0]); + //free(sborder[0]); + //sborder[0] = sb; + //const endidx = len(sborder) - 1; + //const sb = strings::concat(sborder[endidx], defcolor); + //free(sborder[endidx]); + //sborder[endidx] = sb; yield sborder; case void => yield strings::dupall(s); |
