summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-23 15:01:02 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 15:11:06 +1000
commitfce7cdcc0ae54ce625659a178af698db398c047e (patch)
tree237c19ae514418772c94e0a2e5c93b58ac03707d /pkg/gui
parent4fb52ce2abcd9cfbd566188a20c8919e27dafebb (diff)
enlargen stash window when its focused
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/arrangement.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go
index f4b8d494c..59fa87a01 100644
--- a/pkg/gui/arrangement.go
+++ b/pkg/gui/arrangement.go
@@ -165,6 +165,28 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map
return boxlayout.ArrangeWindows(root, 0, 0, width, height)
}
+// The stash window by default only contains one line so that it's not hogging
+// too much space, but if you access it it should take up some space. This is
+// the default behaviour when accordian mode is NOT in effect. If it is in effect
+// then when it's accessed it will have weight 2, not 1.
+func (gui *Gui) getDefaultStashWindowBox() *boxlayout.Box {
+ box := &boxlayout.Box{Window: "stash"}
+ stashWindowAccessed := false
+ for _, context := range gui.State.ContextStack {
+ if context.GetWindowName() == "stash" {
+ stashWindowAccessed = true
+ }
+ }
+ // if the stash window is anywhere in our stack we should enlargen it
+ if stashWindowAccessed {
+ box.Weight = 1
+ } else {
+ box.Size = 3
+ }
+
+ return box
+}
+
func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
currentWindow := gui.currentSideWindowName()
@@ -211,7 +233,7 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
accordianBox(&boxlayout.Box{Window: "files", Weight: 1}),
accordianBox(&boxlayout.Box{Window: "branches", Weight: 1}),
accordianBox(&boxlayout.Box{Window: "commits", Weight: 1}),
- accordianBox(&boxlayout.Box{Window: "stash", Size: 3}),
+ accordianBox(gui.getDefaultStashWindowBox()),
}
} else {
squashedHeight := 1