diff options
| author | Julian Hurst <ark@mansus.space> | 2025-03-19 23:53:56 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2025-03-19 23:53:58 +0100 |
| commit | 05794aae570fd3c2f6ed27937b785f3d086f57f4 (patch) | |
| tree | daadef54404131604bbda28cfa315f2d8eb5e522 /tui/widget/text | |
| parent | 0d8f330ccf366a2733bb6d5d1e51eef3579f04aa (diff) | |
| download | hare-tui-05794aae570fd3c2f6ed27937b785f3d086f57f4.tar.gz | |
Replace widget buf string with linesbuf
This allows the generic widget print code to iterate more easily on the
lines and to apply widget-specific styles without breaking them by
truncating the console codes.
Diffstat (limited to 'tui/widget/text')
| -rw-r--r-- | tui/widget/text/text.ha | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tui/widget/text/text.ha b/tui/widget/text/text.ha index 0a30eb0..40b3f58 100644 --- a/tui/widget/text/text.ha +++ b/tui/widget/text/text.ha @@ -2,7 +2,6 @@ use io; use unix::tty; use tui; use tui::widget; -use strings; export type text = struct { widget: widget::widget, @@ -19,7 +18,7 @@ export fn newtext(state: *tui::tui, txt: str, pos: widget::coords, style: (*widg pos = pos, sz = void, style = style, - damage = widget::all, + damage = widget::damageall, ... }, txt = txt, @@ -28,8 +27,10 @@ export fn newtext(state: *tui::tui, txt: str, pos: widget::coords, style: (*widg fn printtext(widget: *widget::widget) void = { const widget = widget: *text; - widget.widget.buf = strings::dup(widget.txt); - defer free(widget.widget.buf); + widget.widget.buf = widget::linesbuf { + lines = [widget.txt], + ... + }; widget::print(widget); }; |
