MCPcopy
hub / github.com/wavetermdev/waveterm / GetLineColFromOffset

Function GetLineColFromOffset

pkg/util/utilfn/utilfn.go:915–927  ·  view source on GitHub ↗
(barr []byte, offset int)

Source from the content-addressed store, hash-verified

913}
914
915func GetLineColFromOffset(barr []byte, offset int) (int, int) {
916 line := 1
917 col := 1
918 for i := 0; i < offset && i < len(barr); i++ {
919 if barr[i] == '\n' {
920 line++
921 col = 1
922 } else {
923 col++
924 }
925 }
926 return line, col
927}
928
929func FindStringInSlice(slice []string, val string) int {
930 for idx, v := range slice {

Callers 1

readConfigHelperFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected