@@ -28,7 +28,7 @@ type Pipe struct {
28
28
fromHash * string
29
29
toHash * string
30
30
kind PipeKind
31
- style style.TextStyle
31
+ style * style.TextStyle
32
32
}
33
33
34
34
var (
@@ -45,7 +45,7 @@ func (self Pipe) right() int {
45
45
return max (self .fromPos , self .toPos )
46
46
}
47
47
48
- func RenderCommitGraph (commits []* models.Commit , selectedCommitHash * string , getStyle func (c * models.Commit ) style.TextStyle ) []string {
48
+ func RenderCommitGraph (commits []* models.Commit , selectedCommitHash * string , getStyle func (c * models.Commit ) * style.TextStyle ) []string {
49
49
pipeSets := GetPipeSets (commits , getStyle )
50
50
if len (pipeSets ) == 0 {
51
51
return nil
@@ -56,12 +56,12 @@ func RenderCommitGraph(commits []*models.Commit, selectedCommitHash *string, get
56
56
return lines
57
57
}
58
58
59
- func GetPipeSets (commits []* models.Commit , getStyle func (c * models.Commit ) style.TextStyle ) [][]Pipe {
59
+ func GetPipeSets (commits []* models.Commit , getStyle func (c * models.Commit ) * style.TextStyle ) [][]Pipe {
60
60
if len (commits ) == 0 {
61
61
return nil
62
62
}
63
63
64
- pipes := []Pipe {{fromPos : 0 , toPos : 0 , fromHash : & StartCommitHash , toHash : commits [0 ].HashPtr (), kind : STARTS , style : style .FgDefault }}
64
+ pipes := []Pipe {{fromPos : 0 , toPos : 0 , fromHash : & StartCommitHash , toHash : commits [0 ].HashPtr (), kind : STARTS , style : & style .FgDefault }}
65
65
66
66
return lo .Map (commits , func (commit * models.Commit , _ int ) []Pipe {
67
67
pipes = getNextPipes (pipes , commit , getStyle )
@@ -106,7 +106,7 @@ func RenderAux(pipeSets [][]Pipe, commits []*models.Commit, selectedCommitHash *
106
106
return lo .Flatten (chunks )
107
107
}
108
108
109
- func getNextPipes (prevPipes []Pipe , commit * models.Commit , getStyle func (c * models.Commit ) style.TextStyle ) []Pipe {
109
+ func getNextPipes (prevPipes []Pipe , commit * models.Commit , getStyle func (c * models.Commit ) * style.TextStyle ) []Pipe {
110
110
maxPos := 0
111
111
for _ , pipe := range prevPipes {
112
112
if pipe .toPos > maxPos {
@@ -293,10 +293,10 @@ func renderPipeSet(
293
293
isMerge := startCount > 1
294
294
295
295
cells := lo .Map (lo .Range (maxPos + 1 ), func (i int , _ int ) * Cell {
296
- return & Cell {cellType : CONNECTION , style : style .FgDefault }
296
+ return & Cell {cellType : CONNECTION , style : & style .FgDefault }
297
297
})
298
298
299
- renderPipe := func (pipe * Pipe , style style.TextStyle , overrideRightStyle bool ) {
299
+ renderPipe := func (pipe * Pipe , style * style.TextStyle , overrideRightStyle bool ) {
300
300
left := pipe .left ()
301
301
right := pipe .right ()
302
302
@@ -352,9 +352,9 @@ func renderPipeSet(
352
352
}
353
353
}
354
354
for _ , pipe := range selectedPipes {
355
- renderPipe (& pipe , highlightStyle , true )
355
+ renderPipe (& pipe , & highlightStyle , true )
356
356
if pipe .toPos == commitPos {
357
- cells [pipe .toPos ].setStyle (highlightStyle )
357
+ cells [pipe .toPos ].setStyle (& highlightStyle )
358
358
}
359
359
}
360
360
0 commit comments