formatLineList renders a sorted line list as "12, 47, 89", truncated to maxHintLines entries with " and N more" when more exist.
(lines []int)
| 1300 | // formatLineList renders a sorted line list as "12, 47, 89", truncated |
| 1301 | // to maxHintLines entries with " and N more" when more exist. |
| 1302 | func formatLineList(lines []int) string { |
| 1303 | var b strings.Builder |
| 1304 | shown := min(len(lines), maxHintLines) |
| 1305 | for i := 0; i < shown; i++ { |
| 1306 | if i > 0 { |
| 1307 | _, _ = b.WriteString(", ") |
| 1308 | } |
| 1309 | _, _ = fmt.Fprintf(&b, "%d", lines[i]) |
| 1310 | } |
| 1311 | if rest := len(lines) - shown; rest > 0 { |
| 1312 | _, _ = fmt.Fprintf(&b, " and %d more", rest) |
| 1313 | } |
| 1314 | return b.String() |
| 1315 | } |
| 1316 | |
| 1317 | // miscountHint detects search lines that match a file line except for |
| 1318 | // the count of one repeated rune. Emits one hint per |
no test coverage detected