diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 21:39:59 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-26 21:44:33 +1100 |
commit | 83757f10658415e48b22e2521885d42b712a5e37 (patch) | |
tree | 35665e4869d2f48c494a9d4ffce13717da34ef73 /pkg/gui/confirmation_panel.go | |
parent | f2036b42e53e1fc647f431e08e078e5c96bc4352 (diff) |
limit size of menu panel
Diffstat (limited to 'pkg/gui/confirmation_panel.go')
-rw-r--r-- | pkg/gui/confirmation_panel.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 755d13f96..112f4769a 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -39,7 +39,8 @@ func (gui *Gui) closeConfirmationPrompt(g *gocui.Gui, returnFocusOnClose bool) e panic(err) } } - g.DeleteKeybindings("confirmation") + g.DeleteKeybinding("confirmation", gocui.KeyEnter, gocui.ModNone) + g.DeleteKeybinding("confirmation", gocui.KeyEsc, gocui.ModNone) return g.DeleteView("confirmation") } @@ -61,6 +62,9 @@ func (gui *Gui) getConfirmationPanelDimensions(g *gocui.Gui, wrap bool, prompt s width, height := g.Size() panelWidth := 4 * width / 7 panelHeight := gui.getMessageHeight(wrap, prompt, panelWidth) + if panelHeight > height*3/4 { + panelHeight = height * 3 / 4 + } return width/2 - panelWidth/2, height/2 - panelHeight/2 - panelHeight%2 - 1, width/2 + panelWidth/2, @@ -149,6 +153,7 @@ func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*go "keyBindConfirm": "enter", }, ) + gui.renderString(g, "options", actions) if err := g.SetKeybinding("confirmation", nil, gocui.KeyEnter, gocui.ModNone, gui.wrappedConfirmationFunction(handleConfirm, returnFocusOnClose)); err != nil { return err |