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:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user