summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-03-04 14:43:20 +0100
committerStefan Haller <stefan@haller-berlin.de>2023-03-04 15:07:48 +0100
commit723504a290ca208c5ee8dc67c86b69b98cfbd069 (patch)
treeb2179df6d685d8fda94379c0b5f17caca0258a27 /pkg/gui
parent40a29fd622df85094f9982426437b30d0b603abc (diff)
Keep side context in context stack when pushing a main context
This fixes accordion mode for the commit files panel. When entering a file, the commit files panel should stay expanded.
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/context.go5
-rw-r--r--pkg/gui/controllers/helpers/patch_building_helper.go2
-rw-r--r--pkg/gui/controllers/merge_conflicts_controller.go2
-rw-r--r--pkg/gui/controllers/staging_controller.go2
4 files changed, 7 insertions, 4 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index e4719ab13..61de2d8dc 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -78,12 +78,15 @@ func (gui *Gui) pushToContextStack(c types.Context) []types.Context {
gui.State.ContextManager.ContextStack = []types.Context{c}
} else if c.GetKind() == types.MAIN_CONTEXT {
// if we're switching to a main context, remove all other main contexts in the stack
+ contextsToKeep := []types.Context{}
for _, stackContext := range gui.State.ContextManager.ContextStack {
if stackContext.GetKind() == types.MAIN_CONTEXT {
contextsToDeactivate = append(contextsToDeactivate, stackContext)
+ } else {
+ contextsToKeep = append(contextsToKeep, stackContext)
}
}
- gui.State.ContextManager.ContextStack = []types.Context{c}
+ gui.State.ContextManager.ContextStack = append(contextsToKeep, c)
} else {
topContext := gui.currentContextWithoutLock()
diff --git a/pkg/gui/controllers/helpers/patch_building_helper.go b/pkg/gui/controllers/helpers/patch_building_helper.go
index 25ac63a08..646a8f167 100644
--- a/pkg/gui/controllers/helpers/patch_building_helper.go
+++ b/pkg/gui/controllers/helpers/patch_building_helper.go
@@ -38,7 +38,7 @@ func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)
// takes us from the patch building panel back to the commit files panel
func (self *PatchBuildingHelper) Escape() error {
- return self.c.PushContext(self.contexts.CommitFiles)
+ return self.c.PopContext()
}
// kills the custom patch and returns us back to the commit files panel if needed
diff --git a/pkg/gui/controllers/merge_conflicts_controller.go b/pkg/gui/controllers/merge_conflicts_controller.go
index 90da5283c..b35f846c2 100644
--- a/pkg/gui/controllers/merge_conflicts_controller.go
+++ b/pkg/gui/controllers/merge_conflicts_controller.go
@@ -162,7 +162,7 @@ func (self *MergeConflictsController) context() *context.MergeConflictsContext {
}
func (self *MergeConflictsController) Escape() error {
- return self.c.PushContext(self.contexts.Files)
+ return self.c.PopContext()
}
func (self *MergeConflictsController) HandleEditFile() error {
diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go
index 0a8ca5521..0cddfb841 100644
--- a/pkg/gui/controllers/staging_controller.go
+++ b/pkg/gui/controllers/staging_controller.go
@@ -133,7 +133,7 @@ func (self *StagingController) EditFile() error {
}
func (self *StagingController) Escape() error {
- return self.c.PushContext(self.contexts.Files)
+ return self.c.PopContext()
}
func (self *StagingController) TogglePanel() error {