MCPcopy
hub / github.com/jesseduffield/lazygit / HunkOldStartForLine

Method HunkOldStartForLine

pkg/commands/patch/patch.go:56–62  ·  view source on GitHub ↗

Returns the old-file starting line number of the hunk containing the given patch line index. Returns 0 if the line is not inside any hunk.

(idx int)

Source from the content-addressed store, hash-verified

54// Returns the old-file starting line number of the hunk containing the given
55// patch line index. Returns 0 if the line is not inside any hunk.
56func (self *Patch) HunkOldStartForLine(idx int) int {
57 hunkIdx := self.HunkContainingLine(idx)
58 if hunkIdx == -1 {
59 return 0
60 }
61 return self.hunks[hunkIdx].oldStart
62}
63
64// Returns the patch line index of the first line in the given hunk
65func (self *Patch) HunkStartIdx(hunkIndex int) int {

Callers 1

NewStateFunction · 0.80

Calls 1

HunkContainingLineMethod · 0.95

Tested by

no test coverage detected