Skip to content

Commit

Permalink
UI dialog size adjusmentse
Browse files Browse the repository at this point in the history
Signed-off-by: Navid Yaghoobi <[email protected]>
  • Loading branch information
navidys committed Mar 8, 2025
1 parent 5022bef commit 9312e8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ui/dialogs/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
6 changes: 3 additions & 3 deletions ui/dialogs/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions ui/dialogs/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9312e8d

Please sign in to comment.