MCPcopy Index your code
hub / github.com/expr-lang/expr / formatRangeContext

Function formatRangeContext

internal/difflib/difflib.go:645–656  ·  view source on GitHub ↗

Convert range to the "ed" format.

(start, stop int)

Source from the content-addressed store, hash-verified

643
644// Convert range to the "ed" format.
645func 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
658type ContextDiff UnifiedDiff
659

Callers 1

WriteContextDiffFunction · 0.85

Calls 1

SprintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…