From e8e7ddea4563d853c7dec7c3a749f846554c1106 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 26 Jan 2024 17:36:42 +0100 Subject: [PATCH 1/2] Fix typo --- pkg/integration/tests/patch_building/select_all_files.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/integration/tests/patch_building/select_all_files.go b/pkg/integration/tests/patch_building/select_all_files.go index 711d31c29..5665cef50 100644 --- a/pkg/integration/tests/patch_building/select_all_files.go +++ b/pkg/integration/tests/patch_building/select_all_files.go @@ -6,7 +6,7 @@ import ( ) var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{ - Description: "All all files of a commit to a custom patch with the 'a' keybinding", + Description: "Add all files of a commit to a custom patch with the 'a' keybinding", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, From c66667c8c1d68758d31e265acfc3fdf7aff4f8c0 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 26 Jan 2024 17:39:03 +0100 Subject: [PATCH 2/2] Fix main view refresh after adding the first file to a custom patch This broke with 240948b. --- pkg/gui/controllers/helpers/inline_status_helper.go | 2 +- pkg/gui/controllers/helpers/window_helper.go | 6 +++--- pkg/gui/main_panels.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/gui/controllers/helpers/inline_status_helper.go b/pkg/gui/controllers/helpers/inline_status_helper.go index 7368986bd..2476a57cf 100644 --- a/pkg/gui/controllers/helpers/inline_status_helper.go +++ b/pkg/gui/controllers/helpers/inline_status_helper.go @@ -66,7 +66,7 @@ func (self inlineStatusHelperTask) Continue() { func (self *InlineStatusHelper) WithInlineStatus(opts InlineStatusOpts, f func(gocui.Task) error) { context := self.c.ContextForKey(opts.ContextKey).(types.IListContext) view := context.GetView() - visible := view.Visible && self.windowHelper.TopViewInWindow(context.GetWindowName()) == view + visible := view.Visible && self.windowHelper.TopViewInWindow(context.GetWindowName(), false) == view if visible && context.IsItemVisible(opts.Item) { self.c.OnWorker(func(task gocui.Task) { self.start(opts) diff --git a/pkg/gui/controllers/helpers/window_helper.go b/pkg/gui/controllers/helpers/window_helper.go index 4bdd7a889..c0bdc2ab6 100644 --- a/pkg/gui/controllers/helpers/window_helper.go +++ b/pkg/gui/controllers/helpers/window_helper.go @@ -90,7 +90,7 @@ func (self *WindowHelper) MoveToTopOfWindow(context types.Context) { window := context.GetWindowName() - topView := self.TopViewInWindow(window) + topView := self.TopViewInWindow(window, true) if topView != nil && view.Name() != topView.Name() { if err := self.c.GocuiGui().SetViewOnTopOf(view.Name(), topView.Name()); err != nil { @@ -99,14 +99,14 @@ func (self *WindowHelper) MoveToTopOfWindow(context types.Context) { } } -func (self *WindowHelper) TopViewInWindow(windowName string) *gocui.View { +func (self *WindowHelper) TopViewInWindow(windowName string, includeInvisibleViews bool) *gocui.View { // now I need to find all views in that same window, via contexts. And I guess then I need to find the index of the highest view in that list. viewNamesInWindow := self.viewNamesInWindow(windowName) // The views list is ordered highest-last, so we're grabbing the last view of the window var topView *gocui.View for _, currentView := range self.c.GocuiGui().Views() { - if lo.Contains(viewNamesInWindow, currentView.Name()) && currentView.Visible { + if lo.Contains(viewNamesInWindow, currentView.Name()) && (currentView.Visible || includeInvisibleViews) { topView = currentView } } diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go index 3dee86f1b..bf30331cd 100644 --- a/pkg/gui/main_panels.go +++ b/pkg/gui/main_panels.go @@ -38,7 +38,7 @@ func (gui *Gui) moveMainContextToTop(context types.Context) { view := context.GetView() - topView := gui.helpers.Window.TopViewInWindow(context.GetWindowName()) + topView := gui.helpers.Window.TopViewInWindow(context.GetWindowName(), true) if topView != nil && topView != view { // We need to copy the content to avoid a flicker effect: If we're flicking