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

Function ModuloWithWrap

pkg/utils/utils.go:39–50  ·  view source on GitHub ↗

used to keep a number n between 0 and max, allowing for wraparounds

(n, max int)

Source from the content-addressed store, hash-verified

37
38// used to keep a number n between 0 and max, allowing for wraparounds
39func ModuloWithWrap(n, max int) int {
40 if max == 0 {
41 return 0
42 }
43
44 if n >= max {
45 return n % max
46 } else if n < 0 {
47 return max + n
48 }
49 return n
50}
51
52func FindStringSubmatch(str string, regexpStr string) (bool, []string) {
53 re := regexp.MustCompile(regexpStr)

Callers 3

handleNextTabMethod · 0.92
handlePrevTabMethod · 0.92
TestModuloWithWrapFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestModuloWithWrapFunction · 0.68