support accordian mode i.e. expanding focused side panels

This commit is contained in:
Jesse Duffield 2020-08-12 22:06:37 +10:00
parent 28ba142fd6
commit 35b72420ad
3 changed files with 18 additions and 16 deletions

View file

@ -14,6 +14,7 @@ Default path for the config file:
scrollHeight: 2 # how many lines you scroll by
scrollPastBottom: true # enable scrolling past the bottom
sidePanelWidth: 0.3333 # number from 0 to 1
expandFocusedSidePanel: false
theme:
lightTheme: false # For terminals with a light background
activeBorderColor:

View file

@ -246,6 +246,7 @@ func GetDefaultConfig() []byte {
skipUnstageLineWarning: false
skipStashWarning: true
sidePanelWidth: 0.3333
expandFocusedSidePanel: false
theme:
lightTheme: false
activeBorderColor:

View file

@ -181,27 +181,27 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*box {
fullHeightBox("stash"),
}
} else if height >= 28 {
accordianMode := gui.Config.GetUserConfig().GetBool("gui.expandFocusedSidePanel")
accordianBox := func(defaultBox *box) *box {
if accordianMode && defaultBox.viewName == currentCyclableViewName {
return &box{
viewName: defaultBox.viewName,
weight: 2,
}
}
return defaultBox
}
return []*box{
{
viewName: "status",
size: 3,
},
{
viewName: "files",
weight: 1,
},
{
viewName: "branches",
weight: 1,
},
{
viewName: "commits",
weight: 1,
},
{
viewName: "stash",
size: 3,
},
accordianBox(&box{viewName: "files", weight: 1}),
accordianBox(&box{viewName: "branches", weight: 1}),
accordianBox(&box{viewName: "commits", weight: 1}),
accordianBox(&box{viewName: "stash", size: 3}),
}
} else {
squashedHeight := 1