From c3d1a79a89d335bb539db78bf55fae067886c8f5 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 24 Jun 2024 18:45:30 +0200 Subject: [PATCH] Fix clicking outside of the commit description panel or suggestions panel We forgot to handle the "suggestions" and "commitDescription" view names. Instead of listing all the names of views that can appear in popups though, let's use the context kind for this, which feels more robust. This is a change in behavior: previously, clicking outside of the search or filter prompt would close the prompt, now it no longer does (because search has a persistent popup kind, but it wasn't listed in the list of view names before). --- pkg/gui/controllers/helpers/confirmation_helper.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 8f7c60b5a..4fed9ab0b 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -454,12 +454,12 @@ func (self *ConfirmationHelper) ResizeCommitMessagePanels() { _, _ = self.c.GocuiGui().SetView(self.c.Views().CommitDescription.Name(), x0, y0+summaryViewHeight, x1, y1+summaryViewHeight, 0) } -func (self *ConfirmationHelper) IsPopupPanel(viewName string) bool { - return viewName == "commitMessage" || viewName == "confirmation" || viewName == "menu" +func (self *ConfirmationHelper) IsPopupPanel(context types.Context) bool { + return context.GetKind() == types.PERSISTENT_POPUP || context.GetKind() == types.TEMPORARY_POPUP } func (self *ConfirmationHelper) IsPopupPanelFocused() bool { - return self.IsPopupPanel(self.c.CurrentContext().GetViewName()) + return self.IsPopupPanel(self.c.CurrentContext()) } func (self *ConfirmationHelper) TooltipForMenuItem(menuItem *types.MenuItem) string {