From cac8c4ed7ad81e59091b55d704c1c10d0547c643 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Wed, 5 Jun 2024 08:34:40 +0200 Subject: 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 Tested-by: Johannes Thyssen Tishman --- app/selector.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app') 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 -- cgit