From 28ba142fd6f091df4185bb06cfa24679d3de0ab6 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Wed, 12 Aug 2020 21:48:29 +1000 Subject: [PATCH] set minimum confirmation box width --- pkg/gui/confirmation_panel.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 8aec1b6a8..037be36bd 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -60,7 +60,16 @@ func (gui *Gui) getMessageHeight(wrap bool, message string, width int) int { func (gui *Gui) getConfirmationPanelDimensions(g *gocui.Gui, wrap bool, prompt string) (int, int, int, int) { width, height := g.Size() + // we want a minimum width up to a point, then we do it based on ratio. panelWidth := 4 * width / 7 + minWidth := 80 + if panelWidth < minWidth { + if width-2 < minWidth { + panelWidth = width - 2 + } else { + panelWidth = minWidth + } + } panelHeight := gui.getMessageHeight(wrap, prompt, panelWidth) if panelHeight > height*3/4 { panelHeight = height * 3 / 4