summaryrefslogtreecommitdiff
path: root/tui/widget/list
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2025-03-12 22:36:13 +0100
committerJulian Hurst <ark@mansus.space>2025-03-12 22:36:13 +0100
commite074c936bb99ccfce311445f4dbf42ba964b44a4 (patch)
treea2ca68130a4a6a532df3f7362d3cad0574d50259 /tui/widget/list
parent6bab265109546396730d84a4189610eca094c62a (diff)
downloadhare-tui-e074c936bb99ccfce311445f4dbf42ba964b44a4.tar.gz
Implement global state and clear scheduling
Diffstat (limited to 'tui/widget/list')
-rw-r--r--tui/widget/list/list.ha7
1 files changed, 4 insertions, 3 deletions
diff --git a/tui/widget/list/list.ha b/tui/widget/list/list.ha
index 50fb8df..ca7571b 100644
--- a/tui/widget/list/list.ha
+++ b/tui/widget/list/list.ha
@@ -1,3 +1,4 @@
+use tui;
use tui::widget;
use io;
use unix::tty;
@@ -18,9 +19,9 @@ export type list = struct {
// Return an instance of list. out is the tty file, pos the starting position,
// sz is the size of the widget (if void is used, the maximum possible
// size is used), items is the slice of items of the list.
-export fn newlist(out: io::file, pos: widget::coords, sz: widget::widgetsize,
+export fn newlist(state: *tui::tui, pos: widget::coords, sz: widget::widgetsize,
style: (*widget::style | void), items: str...) (list | tty::error) = {
- const tsz = tty::winsize(out)?;
+ const tsz = tty::winsize(state.out)?;
let end = match (sz) {
case let sz: tty::ttysize =>
@@ -35,7 +36,7 @@ style: (*widget::style | void), items: str...) (list | tty::error) = {
return list {
widget = widget::widget {
- out = out,
+ state = state,
print = &printlist,
resize = &resizelist,
pos = pos,