diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-12 21:48:29 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-13 21:50:23 +1000 |
commit | 28ba142fd6f091df4185bb06cfa24679d3de0ab6 (patch) | |
tree | 72bfe01a5064e07b003bc574235e3c9a4349a46b /pkg/gui/confirmation_panel.go | |
parent | b39bcd5c61cfac6156217a37ea90b7e2eb6b112a (diff) |
set minimum confirmation box width
Diffstat (limited to 'pkg/gui/confirmation_panel.go')
-rw-r--r-- | pkg/gui/confirmation_panel.go | 9 |
1 files changed, 9 insertions, 0 deletions
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 |