aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-06-05 08:34:40 +0200
committerRobin Jarry <robin@jarry.cc>2024-06-16 14:05:02 +0200
commitcac8c4ed7ad81e59091b55d704c1c10d0547c643 (patch)
treeb5d5bcd07dd2170d37464e12c41bd8c9db91c69e /app
parent99bc69918ea782603894de8ab5f66d53a10046a2 (diff)
downloadaerc-cac8c4ed7ad81e59091b55d704c1c10d0547c643.tar.gz
selector: fix body text truncation
When the selector dialog body text contains multiple lines, its height is adjusted automatically. Since commit 3d529aa09330 ("config: make popover dialogs configurable"), all text after the first line is truncated. This happens because SelectorDialog no longer satisfies the Dialog interface which got an extra ContextWidth() method. Implement that method using the full width. The [ui].dialog-* settings are ignored as they were before for that dialog. Fixes: 3d529aa09330 ("config: make popover dialogs configurable") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Diffstat (limited to 'app')
-rw-r--r--app/selector.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/selector.go b/app/selector.go
index 252616f0..705021f8 100644
--- a/app/selector.go
+++ b/app/selector.go
@@ -214,6 +214,18 @@ func (gp *SelectorDialog) Draw(ctx *ui.Context) {
gp.selector.Draw(ctx.Subcontext(1, ctx.Height()-1, ctx.Width()-2, 1))
}
+func (gp *SelectorDialog) ContextWidth() (func(int) int, func(int) int) {
+ // horizontal starting position in columns from the left
+ start := func(int) int {
+ return 4
+ }
+ // dialog width from the starting column
+ width := func(w int) int {
+ return w - 8
+ }
+ return start, width
+}
+
func (gp *SelectorDialog) ContextHeight() (func(int) int, func(int) int) {
totalHeight := 2 // title + empty line
totalHeight += strings.Count(gp.prompt, "\n") + 1