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

Function formatRangeUnified

internal/difflib/difflib.go:518–529  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop int)

Source from the content-addressed store, hash-verified

516
517// Convert range to the "ed" format
518func 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
532type UnifiedDiff struct {

Callers 1

WriteUnifiedDiffFunction · 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…