Convert range to the "ed" format
(start, stop int)
| 516 | |
| 517 | // Convert range to the "ed" format |
| 518 | func formatRangeUnified(start, stop int) string { |
| 519 | // Per the diff spec at http://www.unix.org/single_unix_specification/ |
| 520 | beginning := start + 1 // lines start numbering with one |
| 521 | length := stop - start |
| 522 | if length == 1 { |
| 523 | return fmt.Sprintf("%d", beginning) |
| 524 | } |
| 525 | if length == 0 { |
| 526 | beginning -= 1 // empty ranges begin at line just before the range |
| 527 | } |
| 528 | return fmt.Sprintf("%d,%d", beginning, length) |
| 529 | } |
| 530 | |
| 531 | // Unified diff parameters |
| 532 | type UnifiedDiff struct { |
no test coverage detected
searching dependent graphs…