From 9312e8decda5498e37b82fd6d9dd49259677be33 Mon Sep 17 00:00:00 2001 From: Navid Yaghoobi Date: Fri, 7 Mar 2025 19:53:17 +1100 Subject: [PATCH] UI dialog size adjusmentse Signed-off-by: Navid Yaghoobi --- ui/dialogs/confirm.go | 4 ++-- ui/dialogs/message.go | 6 +++--- ui/dialogs/message_test.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/dialogs/confirm.go b/ui/dialogs/confirm.go index 60b846ffc..5ef9551e4 100644 --- a/ui/dialogs/confirm.go +++ b/ui/dialogs/confirm.go @@ -134,9 +134,9 @@ func (d *ConfirmDialog) setRect() { if d.width > DialogMinWidth { if messageWidth < DialogMinWidth { - d.width = DialogMinWidth + 2 //nolint:mnd + d.width = DialogMinWidth + 4 //nolint:mnd } else if messageWidth < d.width { - d.width = messageWidth + 2 //nolint:mnd + d.width = messageWidth + 6 //nolint:mnd } } diff --git a/ui/dialogs/message.go b/ui/dialogs/message.go index 32fc0752b..c67d81402 100644 --- a/ui/dialogs/message.go +++ b/ui/dialogs/message.go @@ -205,8 +205,8 @@ func (d *MessageDialog) SetRect(x, y, width, height int) { } dWidth := width - (2 * DialogPadding) //nolint:mnd - if messageWidth+4 < dWidth { - dWidth = messageWidth + 4 //nolint:mnd + if messageWidth+6 < dWidth { + dWidth = messageWidth + 6 //nolint:mnd } if DialogMinWidth < width && dWidth < DialogMinWidth { @@ -216,7 +216,7 @@ func (d *MessageDialog) SetRect(x, y, width, height int) { emptySpace := (width - dWidth) / 2 //nolint:mnd dX := x + emptySpace - dHeight := messageHeight + DialogFormHeight + DialogPadding + 1 + dHeight := messageHeight + DialogFormHeight + DialogPadding if dHeight > height { dHeight = height - DialogPadding - 1 } diff --git a/ui/dialogs/message_test.go b/ui/dialogs/message_test.go index c8f0f8c48..491983ed6 100644 --- a/ui/dialogs/message_test.go +++ b/ui/dialogs/message_test.go @@ -62,9 +62,9 @@ var _ = Describe("message dialog", Ordered, func() { height := 20 // wants wWants := 40 - hWants := 11 - xWants := 5 // 0 + (50-40)/2 - yWants := 4 // 0 + (20-8)/2 - 2 + hWants := 10 + xWants := 5 + yWants := 5 messageDialog.SetRect(x, y, width, height) x1, y1, w1, h1 := messageDialog.Box.GetRect()