MCPcopy Create free account
hub / github.com/cogentcore/core / formatRangeUnified

Function formatRangeUnified

texteditor/difflib/difflib.go:773–784  ·  view source on GitHub ↗

Convert range to the "ed" format

(start, stop int)

Source from the content-addressed store, hash-verified

771
772// Convert range to the "ed" format
773func formatRangeUnified(start, stop int) string {
774 // Per the diff spec at http://www.unix.org/single_unix_specification/
775 beginning := start + 1 // lines start numbering with one
776 length := stop - start
777 if length == 1 {
778 return fmt.Sprintf("%d", beginning)
779 }
780 if length == 0 {
781 beginning -= 1 // empty ranges begin at line just before the range
782 }
783 return fmt.Sprintf("%d,%d", beginning, length)
784}
785
786// LineDiffParams contains unified diff parameters
787type LineDiffParams struct {

Callers 1

WriteUnifiedDiffFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected