aboutsummaryrefslogtreecommitdiff
path: root/main.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2022-05-17 17:26:49 +0200
committerJulian Hurst <ark@mansus.space>2022-05-17 17:26:49 +0200
commitf39c8515280c43151c3b03ef52aaf167e472d45d (patch)
tree5372412b5e0c6aa17d617476efcb48053e406764 /main.ha
parentdd0f6591ca1d8c320a1a3dbe2def9795373d7059 (diff)
downloadilhare-f39c8515280c43151c3b03ef52aaf167e472d45d.tar.gz
list: reset, somewhat decent resize implementation and fix reframe
list::reframe had buggy behaviour (especially after previous commit). list::reset allows easily resetting the list (cursor = 0, reset frame). list::resize allows resizing the list after a sigwinch more easily. It's a bit of a bitch to get a pretty, non-brutal (without cursor/frame resetting to avoid "jumping" effect) list resize, this algo acheives it somewhat decently and keeps the selected item in a somewhat predictable position.
Diffstat (limited to 'main.ha')
-rw-r--r--main.ha7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.ha b/main.ha
index bff260e..51c9b8a 100644
--- a/main.ha
+++ b/main.ha
@@ -28,8 +28,15 @@ fn sighandler(sig: int, info: *signal::siginfo, ucontext: *void) void = {
} else {
yield len(u.list.items);
};
+ const oldsz = list::ttysize {
+ rows = u.list.sz.rows,
+ cols = u.list.sz.cols,
+ };
u.list.sz.rows = rows: u16;
u.list.sz.cols = sz.columns;
+ list::resize(u.list, oldsz);
+ libui::clear(u.list.widget.ui);
+ list::print(u.list)!;
};
};