simplify loop

This commit is contained in:
Özgür Kesim 2024-12-08 22:51:59 +01:00
parent fc42dd0fcc
commit fc558d99f2
Signed by: oec
GPG Key ID: F136A7F922D018D7

View File

@ -70,11 +70,8 @@ func main() {
// We have to calculate the rune position from the byte position. // We have to calculate the rune position from the byte position.
rcount := 0 rcount := 0
idx := 0 idx := 0
cont := false
for p := range before { for p := range before {
cont = false
for i := range edits[idx:] { for i := range edits[idx:] {
cont = true
if edits[i].Start == p { if edits[i].Start == p {
edits[i].Start = rcount edits[i].Start = rcount
} }
@ -84,7 +81,7 @@ func main() {
} }
} }
rcount++ rcount++
if !cont { if idx == len(edits) {
break break
} }
} }