diff options
Diffstat (limited to 'tui/widget/widget.ha')
| -rw-r--r-- | tui/widget/widget.ha | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tui/widget/widget.ha b/tui/widget/widget.ha index be6c255..3e6cf8d 100644 --- a/tui/widget/widget.ha +++ b/tui/widget/widget.ha @@ -198,7 +198,7 @@ export fn print(w: *widget) void = { w.state.clear = false; }; -// Applies styling (style) to the given string. +// Applies styling (style) to the given string slice. fn applystyles(st: (*style | void), s: []str) []str = { return match (st) { case let st: *style => @@ -234,11 +234,11 @@ fn truncate_to_size(w: *widget) []str = { const line = w.buf.lines[i]; let item = match (w.sz) { case let sz: tty::ttysize => - const s = if (len(line) > sz.columns) strings::sub(line, 0z, sz.columns) else line; + const s = if (tui::strwidth(line) > sz.columns) strings::sub(line, 0z, sz.columns) else line; yield strings::rpad(s, ' ', sz.columns); case void => const wsz = tty::winsize(w.state.out)!; - const s = if (len(line) > wsz.columns) strings::sub(line, 0z, wsz.columns) else line; + const s = if (tui::strwidth(line) > wsz.columns) strings::sub(line, 0z, wsz.columns) else line; yield strings::dup(s); }; append(lines, item)!; |
