Index: router.go IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/router.go b/router.go --- a/router.go (revision 3e817bcd279fe973725f82f147923b5981920457) +++ b/router.go (date 1613164585180) @@ -336,6 +336,7 @@ var ( search = path + searchLen = 0 n int // Param counter pvalues = ctx.pvalues // Use the internal slice so the interface can keep the illusion of a dynamic slice @@ -343,7 +344,7 @@ state [backTrackingDepth]struct { nk kind nn *node - ns string + searchLen int np int } stateIndex int = -1 @@ -357,7 +358,7 @@ state[stateIndex].nk = nodeKind state[stateIndex].nn = cn - state[stateIndex].ns = search + state[stateIndex].searchLen = searchLen state[stateIndex].np = n } @@ -371,7 +372,8 @@ nodeKind = last.nk cn = last.nn - search = last.ns + search = path[last.searchLen:] + searchLen = last.searchLen n = last.np valid = cn != nil return @@ -412,6 +414,7 @@ // The full prefix has matched, remove the prefix from the remaining search search = search[l:] + searchLen = searchLen + l // Finish routing if no remaining search and we are on an leaf node if search == "" && cn.ppath != "" { @@ -449,6 +452,7 @@ pvalues[n] = search[:i] n++ search = search[i:] + searchLen = searchLen + i continue }