Convert range to the "ed" format.
(start, stop int)
| 643 | |
| 644 | // Convert range to the "ed" format. |
| 645 | func formatRangeContext(start, stop int) string { |
| 646 | // Per the diff spec at http://www.unix.org/single_unix_specification/ |
| 647 | beginning := start + 1 // lines start numbering with one |
| 648 | length := stop - start |
| 649 | if length == 0 { |
| 650 | beginning -= 1 // empty ranges begin at line just before the range |
| 651 | } |
| 652 | if length <= 1 { |
| 653 | return fmt.Sprintf("%d", beginning) |
| 654 | } |
| 655 | return fmt.Sprintf("%d,%d", beginning, beginning+length-1) |
| 656 | } |
| 657 | |
| 658 | type ContextDiff UnifiedDiff |
| 659 |
no test coverage detected
searching dependent graphs…