@@ -108,20 +108,21 @@ func chunk(s string, maxLength, maxLines int) []string {
108
108
}
109
109
110
110
// If really long, preserve the starting first quarter, the trailing three quarters, and inform.
111
- if len (chunks ) > maxLines {
112
- abbreviator := fmt .Sprintf ("... %d lines are being ignored..." , len (chunks )- maxLines )
111
+ actualLength := len (chunks )
112
+ if actualLength > maxLines {
113
+ abbreviator := fmt .Sprintf ("... %d lines are being ignored..." , actualLength - maxLines )
113
114
chunks = append (
114
115
append (chunks [0 :maxLines / 4 ], abbreviator + strings .Repeat (spacer , maxLength - len (abbreviator ))),
115
- chunks [len ( chunks ) - maxLines * 3 / 4 :]... ,
116
+ chunks [actualLength - maxLines * 3 / 4 :]... ,
116
117
)
117
118
chunks = append (
118
119
[]string {
119
- fmt .Sprintf ("Actual content is %d lines long and has been abbreviated to %d\n " , len ( chunks ) , maxLines ),
120
+ fmt .Sprintf ("Actual content is %d lines long and has been abbreviated to %d\n " , actualLength , maxLines ),
120
121
strings .Repeat (spacer , maxLength ),
121
122
},
122
123
chunks ... ,
123
124
)
124
- } else if len ( chunks ) == 0 {
125
+ } else if actualLength == 0 {
125
126
chunks = []string {strings .Repeat (spacer , maxLength )}
126
127
}
127
128
0 commit comments