1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

would you believe that I'm adding even more generics

This commit is contained in:
Jesse Duffield
2022-03-19 19:51:48 +11:00
parent 1b75ed3740
commit 94a53484a1
14 changed files with 62 additions and 51 deletions

View File

@ -67,13 +67,10 @@ func GetPipeSets(commits []*models.Commit, getStyle func(c *models.Commit) style
pipes := []*Pipe{{fromPos: 0, toPos: 0, fromSha: "START", toSha: commits[0].Sha, kind: STARTS, style: style.FgDefault}}
pipeSets := [][]*Pipe{}
for _, commit := range commits {
return slices.Map(commits, func(commit *models.Commit) []*Pipe {
pipes = getNextPipes(pipes, commit, getStyle)
pipeSets = append(pipeSets, pipes)
}
return pipeSets
return pipes
})
}
func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha string) []string {
@ -115,9 +112,9 @@ func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitSha s
}
func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *models.Commit) style.TextStyle) []*Pipe {
maxPos := lo.Max(
slices.Map(prevPipes, func(pipe *Pipe) int { return pipe.toPos }),
)
maxPos := slices.MaxBy(prevPipes, func(pipe *Pipe) int {
return pipe.toPos
})
// a pipe that terminated in the previous line has no bearing on the current line
// so we'll filter those out