MCPcopy Create free account
hub / github.com/pmezard/go-difflib / formatRangeUnified

Function formatRangeUnified

difflib/difflib.go:515–526  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop int)

Source from the content-addressed store, hash-verified

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

Callers 1

WriteUnifiedDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…