summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst@digdash.com>2025-03-18 17:58:53 +0100
committerJulian Hurst <julian.hurst@digdash.com>2025-03-18 17:58:53 +0100
commit0d8f330ccf366a2733bb6d5d1e51eef3579f04aa (patch)
tree22b532ea092cdb03228d00c4c9894995e78db092 /tui
parenta2f0bd1b76503f7548b05e96d7e5c537b2d6a1b8 (diff)
downloadhare-tui-0d8f330ccf366a2733bb6d5d1e51eef3579f04aa.tar.gz
Refactor damage tracking types
Diffstat (limited to 'tui')
-rw-r--r--tui/widget/list/list.ha2
-rw-r--r--tui/widget/list/scrolllist.ha2
-rw-r--r--tui/widget/widget.ha22
3 files changed, 12 insertions, 14 deletions
diff --git a/tui/widget/list/list.ha b/tui/widget/list/list.ha
index d741a4d..23127ac 100644
--- a/tui/widget/list/list.ha
+++ b/tui/widget/list/list.ha
@@ -43,7 +43,7 @@ style: (*widget::style | void), items: str...) (list | tty::error) = {
pos = pos,
sz = sz,
style = style,
- damage = widget::all,
+ damage = widget::damageall,
...
},
items = items,
diff --git a/tui/widget/list/scrolllist.ha b/tui/widget/list/scrolllist.ha
index 959b9c0..55cee9a 100644
--- a/tui/widget/list/scrolllist.ha
+++ b/tui/widget/list/scrolllist.ha
@@ -39,7 +39,7 @@ style: (*widget::style | void), items: str...) (scrolllist | tty::error) = {
pos = pos,
sz = sz,
style = style,
- damage = widget::all,
+ damage = widget::damageall,
...
},
items = items,
diff --git a/tui/widget/widget.ha b/tui/widget/widget.ha
index 6697935..8422932 100644
--- a/tui/widget/widget.ha
+++ b/tui/widget/widget.ha
@@ -15,15 +15,15 @@ export type finishfn = fn(w: *widget) void;
export type widgetsize = (tty::ttysize | void);
-export type none = void;
-export type all = void;
-export type row = uint;
-export type col = uint;
+export type damagenone = void;
+export type damageall = void;
+export type damagerow = uint;
+export type damagecol = uint;
//export type damageitem = (row | col | coords);
-export type damageitem = row;
+export type damageitem = damagerow;
-export type damage = (none | all | []damageitem);
+export type damage = (damagenone | damageall | []damageitem);
export type widget = struct {
state: *tui::tui,
@@ -132,9 +132,9 @@ export fn print(w: *widget) void = {
//defer tui::raw(w.state)!;
const clear = match (w.damage) {
- case all =>
+ case damageall =>
yield strings::dup(CLEAR);
- case none =>
+ case damagenone =>
yield strings::dup("");
case let dam: []damageitem =>
let st = memio::dynamic();
@@ -250,15 +250,13 @@ export fn finish(w: *widget) void = {
match (w.damage) {
case let dam: []damageitem =>
free(dam);
- case all =>
- return;
- case all =>
+ case damageall =>
return;
};
};
export fn cleardamage(w: *widget) void = {
- let dam = if (w.damage is all) {
+ let dam = if (w.damage is damageall) {
return;
} else {
yield w.damage as []damageitem;