aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-08-08 22:04:02 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-22 09:30:37 +0200
commit00e908e2ae1b851ef1b88f351bf0551bdd76c6fe (patch)
treee32139b32373aaddc68ab13d33d27f6b53acadb6 /widgets/aerc.go
parent9cffc45f0347e5c8b801c151955fa9326b9b2ba7 (diff)
downloadaerc-00e908e2ae1b851ef1b88f351bf0551bdd76c6fe.tar.gz
widgets: add dialog interface
Implement an interface for aerc's dialog implementation. Provide dialogs the ability to set their own height and width of their drawing context. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 2383973a..1e2a4cdd 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -187,7 +187,14 @@ func (aerc *Aerc) Draw(ctx *ui.Context) {
aerc.grid.Draw(ctx)
if aerc.dialog != nil {
if w, h := ctx.Width(), ctx.Height(); w > 8 && h > 4 {
- aerc.dialog.Draw(ctx.Subcontext(4, h/2-2, w-8, 4))
+ if d, ok := aerc.dialog.(Dialog); ok {
+ start, height := d.ContextHeight()
+ aerc.dialog.Draw(
+ ctx.Subcontext(4, start(h),
+ w-8, height(h)))
+ } else {
+ aerc.dialog.Draw(ctx.Subcontext(4, h/2-2, w-8, 4))
+ }
}
}
}