summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-02-25 20:55:36 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-02-25 21:21:07 +1100
commitf94d0be2c9b0eaaf539d2cdcfaf258f754162a2e (patch)
tree0fa95e6348ca35d0938d263b007d9c471a09731e /pkg/gui/branches_panel.go
parent9fd9fd6816925debe64aa21269cdba5ec74ed5e9 (diff)
refactor the way we render lists
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index 5ecb563f2..90d8a2758 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -6,6 +6,7 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
+ "github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -57,13 +58,6 @@ func (gui *Gui) handleBranchSelect(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) RenderSelectedBranchUpstreamDifferences() error {
return gui.newTask("branches", func(stop chan struct{}) error {
- // here we tell the selected branch that it is selected.
- // this is necessary for showing stats on a branch that is selected, because
- // the displaystring function doesn't have access to gui state to tell if it's selected
- for i, branch := range gui.State.Branches {
- branch.Selected = i == gui.State.Panels.Branches.SelectedLine
- }
-
branch := gui.getSelectedBranch()
branch.Pushables, branch.Pullables = gui.GitCommand.GetBranchUpstreamDifferenceCount(branch.Name)
@@ -73,7 +67,10 @@ func (gui *Gui) RenderSelectedBranchUpstreamDifferences() error {
default:
}
- return gui.renderListPanel(gui.getBranchesView(), gui.State.Branches)
+ branchesView := gui.getBranchesView()
+ displayStrings := presentation.GetBranchListDisplayStrings(gui.State.Branches, gui.currentViewName() == "branches", gui.State.Panels.Branches.SelectedLine)
+ gui.renderDisplayStrings(branchesView, displayStrings)
+ return nil
})
}