Skip to content

Commit 99f73bf

Browse files
committed
WIP After going straight to patch building from main view, esc goes all the way back out
I *think* I like it better this way, but it needs more testing.
1 parent 08eb557 commit 99f73bf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/gui/controllers/helpers/patch_building_helper.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ func (self *PatchBuildingHelper) ShowHunkStagingHint() {
4444

4545
// takes us from the patch building panel back to the commit files panel
4646
func (self *PatchBuildingHelper) Escape() {
47-
self.c.Context().Pop()
47+
if parentCtx := self.c.Contexts().CustomPatchBuilder.GetParentContext(); parentCtx != nil {
48+
self.c.Context().Push(parentCtx, types.OnFocusOpts{})
49+
} else {
50+
self.c.Context().Pop()
51+
}
4852
}
4953

5054
// kills the custom patch and returns us back to the commit files panel if needed

pkg/gui/controllers/switch_to_diff_files_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func (self *SwitchToDiffFilesController) GetOnClickFocusedMainView() func(mainVi
8383
context.GetViewTrait().FocusPoint(
8484
context.ModelIndexToViewIndex(idx), false)
8585
node = context.GetSelected()
86+
self.c.Contexts().CustomPatchBuilder.SetParentContext(self.context)
8687
return self.c.Helpers().CommitFiles.EnterCommitFile(node, types.OnFocusOpts{ClickedWindowName: "main", ClickedViewLineIdx: line, ClickedViewRealLineIdx: line})
8788
}
8889
}

0 commit comments

Comments
 (0)