From a38d1a3b689b204f3920dcfc3949bbd7c5c61f44 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 14 Jan 2019 20:25:01 +0900 Subject: [PATCH] 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 --- pkg/gui/confirmation_panel.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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,