Skip to content

Commit b45c992

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 6b1431d commit b45c992

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: pkg/gui/controllers/helpers/patch_building_helper.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)
3030

3131
// takes us from the patch building panel back to the commit files panel
3232
func (self *PatchBuildingHelper) Escape() {
33-
self.c.Context().Pop()
33+
if parentCtx := self.c.Contexts().CustomPatchBuilder.GetParentContext(); parentCtx != nil {
34+
self.c.Context().Push(parentCtx, types.OnFocusOpts{})
35+
} else {
36+
self.c.Context().Pop()
37+
}
3438
}
3539

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

Diff for: pkg/gui/controllers/switch_to_diff_files_controller.go

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func (self *SwitchToDiffFilesController) GetOnClickFocusedMainView() func(mainVi
8181
context.GetViewTrait().FocusPoint(
8282
context.ModelIndexToViewIndex(idx))
8383
node = context.GetSelected()
84+
self.c.Contexts().CustomPatchBuilder.SetParentContext(self.context)
8485
return self.c.Helpers().CommitFiles.EnterCommitFile(node, types.OnFocusOpts{ClickedWindowName: "main", ClickedViewLineIdx: line, ClickedViewRealLineIdx: line})
8586
}
8687
}

0 commit comments

Comments
 (0)