1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

start moving getDisplayStrings funcs into contexts

This commit is contained in:
Jesse Duffield
2023-03-21 21:38:37 +11:00
parent 0e5a4c7a36
commit 1b2fb34ffd
7 changed files with 52 additions and 46 deletions

View File

@@ -2,6 +2,7 @@ package context
import (
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -15,13 +16,18 @@ var (
_ types.DiffableContext = (*BranchesContext)(nil)
)
func NewBranchesContext(
getDisplayStrings func(startIdx int, length int) [][]string,
c *types.HelperCommon,
) *BranchesContext {
func NewBranchesContext(c *types.HelperCommon) *BranchesContext {
viewModel := NewBasicViewModel(func() []*models.Branch { return c.Model().Branches })
getDisplayStrings := func(startIdx int, length int) [][]string {
return presentation.GetBranchListDisplayStrings(
c.Model().Branches,
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
c.Modes().Diffing.Ref,
c.Tr,
)
}
self := &BranchesContext{
BasicViewModel: viewModel,
ListContextTrait: &ListContextTrait{