formatMiscount renders one miscount candidate group.
(sCount int, r rune, cands []candidate)
| 1361 | |
| 1362 | // formatMiscount renders one miscount candidate group. |
| 1363 | func formatMiscount(sCount int, r rune, cands []candidate) string { |
| 1364 | var b strings.Builder |
| 1365 | _, _ = fmt.Fprintf(&b, "Your search has %d %q (U+%04X); the file has ", sCount, string(r), r) |
| 1366 | shown := min(len(cands), maxHintLines) |
| 1367 | for i := 0; i < shown; i++ { |
| 1368 | if i > 0 { |
| 1369 | _, _ = b.WriteString(", ") |
| 1370 | } |
| 1371 | _, _ = fmt.Fprintf(&b, "%d at line %d", cands[i].cCount, cands[i].line) |
| 1372 | } |
| 1373 | if rest := len(cands) - shown; rest > 0 { |
| 1374 | _, _ = fmt.Fprintf(&b, " and %d more", rest) |
| 1375 | } |
| 1376 | return b.String() |
| 1377 | } |
| 1378 | |
| 1379 | // candidate records a file line where one rune's count disagrees with |
| 1380 | // the search. |
no test coverage detected