MCPcopy Index your code
hub / github.com/jesseduffield/lazygit / HunkContainingLine

Method HunkContainingLine

pkg/commands/patch/patch.go:118–126  ·  view source on GitHub ↗

Returns hunk index containing the line at the given patch line index

(idx int)

Source from the content-addressed store, hash-verified

116
117// Returns hunk index containing the line at the given patch line index
118func (self *Patch) HunkContainingLine(idx int) int {
119 for hunkIdx, hunk := range self.hunks {
120 hunkStartIdx := self.HunkStartIdx(hunkIdx)
121 if idx >= hunkStartIdx && idx < hunkStartIdx+hunk.lineCount() {
122 return hunkIdx
123 }
124 }
125 return -1
126}
127
128// Returns the patch line index of the next change (i.e. addition or deletion)
129// that matches the same "included" state, given the includedLines. If you don't

Callers 3

HunkOldStartForLineMethod · 0.95
LineNumberOfLineMethod · 0.95
CurrentHunkBoundsMethod · 0.80

Calls 2

HunkStartIdxMethod · 0.95
lineCountMethod · 0.80

Tested by

no test coverage detected