diff options
| author | Julian Hurst <ark@mansus.space> | 2022-05-17 17:26:49 +0200 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2022-05-17 17:26:49 +0200 |
| commit | f39c8515280c43151c3b03ef52aaf167e472d45d (patch) | |
| tree | 5372412b5e0c6aa17d617476efcb48053e406764 /main.ha | |
| parent | dd0f6591ca1d8c320a1a3dbe2def9795373d7059 (diff) | |
| download | ilhare-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.ha | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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)!; }; }; |
