From 2b49865d0dcd1abe84306b6cd4c700c6348b1453 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 18 Oct 2024 16:27:36 +0200 Subject: [PATCH] Fix: set state to nil when patch building view loses focus This is also what we do in the staging controller, and it makes it so that when you exit the patch building view and then enter it again (for another file, or the same one) we select the first hunk again. --- pkg/gui/controllers/patch_building_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index ea181cd05..5559f6e59 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -73,6 +73,8 @@ func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) { func (self *PatchBuildingController) GetOnFocusLost() func(types.OnFocusLostOpts) { return func(opts types.OnFocusLostOpts) { + self.context().SetState(nil) + self.c.Views().PatchBuilding.Wrap = true if self.c.Git().Patch.PatchBuilder.IsEmpty() {