@@ -79,6 +79,9 @@ func summarizeDiff(diffs []diffmatchpatch.Diff) *FileDiff {
7979 return strings .Split (strings .TrimSpace (strings .ReplaceAll (text , "\r \n " , "\n " )), "\n " )
8080 }
8181
82+ const maxShowLine = 3
83+ const omissionText = "...\n "
84+
8285 for i , diff := range diffs {
8386 text := diff .Text
8487 lines := splitLines (text )
@@ -93,7 +96,7 @@ func summarizeDiff(diffs []diffmatchpatch.Diff) *FileDiff {
9396 case diffmatchpatch .DiffEqual :
9497 var showHead , showTail bool
9598 lastLineBreak = text [len (text )- 1 :] == "\n "
96- partLines := min (3 , len (lines ))
99+ partLines := min (maxShowLine , len (lines ))
97100
98101 if i == 0 {
99102 showTail = true
@@ -120,11 +123,11 @@ func summarizeDiff(diffs []diffmatchpatch.Diff) *FileDiff {
120123 if partText [len (partText )- 1 :] != "\n " {
121124 writeString (& builder , "\n " )
122125 }
123- writeString (& builder , "..." + " \n " )
126+ writeString (& builder , omissionText )
124127 }
125128 if showTail {
126129 if ! showHead && ! lastLineBreak {
127- writeString (& builder , "..." + " \n " )
130+ writeString (& builder , omissionText )
128131 }
129132 writeString (& builder , strings .Join (lines [len (lines )- partLines :], "\n " ))
130133 }
0 commit comments