diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-01-14 20:25:01 +0900 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-01-17 10:29:52 +1100 |
commit | a38d1a3b689b204f3920dcfc3949bbd7c5c61f44 (patch) | |
tree | e09cafd33f35cd8293d5f5a611a3730266986f3e | |
parent | 2dc5e6d50356846fa30cd72f442452a7db9b1203 (diff) |
Explicitly refer confirmation panel view
as @jesseduffield pointed in #358, need to refer
confirmation panel view explicitly in case something
else has focus
Co-Authored-By: KOREAN139 <korean139@gmail.com>
-rw-r--r-- | pkg/gui/confirmation_panel.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 36c0a017e..ef17ccf67 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -54,7 +54,10 @@ func (gui *Gui) getMessageHeight(v *gocui.View, message string, width int) int { func (gui *Gui) getConfirmationPanelDimensions(g *gocui.Gui, prompt string) (int, int, int, int) { width, height := g.Size() panelWidth := width / 2 - view := g.CurrentView() + view, err := gui.g.View("confirmation") + if err != nil { // confirmation panel was deleted so we just return empty values + return 0,0,0,0 + } panelHeight := gui.getMessageHeight(view, prompt, panelWidth) return width/2 - panelWidth/2, height/2 - panelHeight/2 - panelHeight%2 - 1, |