aboutsummaryrefslogtreecommitdiff
path: root/dfm.c
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2026-02-28 09:35:10 +0200
committerDylan Araps <dylan.araps@gmail.com>2026-02-28 09:35:10 +0200
commitf700440f9ca9be7dd6e5615b3a84c1c9e1ca18c2 (patch)
tree6941e2d48c3b2c5f3c2a2f9b0c730a6d75d0b199 /dfm.c
parentfc339fa3cb9c03fdebd300f7018b23931a3eb7bd (diff)
dfm: also wake on winch
This adds responsive resize whilst still allowing dfm to do nothing at idle. Nifty.
Diffstat (limited to 'dfm.c')
-rw-r--r--dfm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/dfm.c b/dfm.c
index f6a30dc..695b0aa 100644
--- a/dfm.c
+++ b/dfm.c
@@ -3342,9 +3342,6 @@ static inline void
fm_update(struct fm *p)
{
term_reap();
- if (unlikely(term_resize(&p->t)))
- if (fm_term_resize(p) < 0)
- fm_draw_err(p, S("resize failed"), errno);
fm_watch_handle(p);
if (!(p->f & FM_DIRTY)) return;
p->f &= ~FM_DIRTY;
@@ -3403,7 +3400,12 @@ fm_run(struct fm *p)
for (; likely(!term_dead(&p->t)); ) {
fm_update(p);
fm_draw(p);
- fm_input(p);
+ int e = term_wait(&p->t);
+ if (e & TERM_WAIT_WCH)
+ if (fm_term_resize(p) < 0)
+ fm_draw_err(p, S("resize failed"), errno);
+ if (e & TERM_WAIT_KEY)
+ fm_input(p);
}
fm_term_free(p);
if (!(p->f & FM_PRINT_PWD)) p->pwd.l = 0;