break out of infinite loop in build-search-list.sml's 'helpBuild' function, by passing 'matchedIdx + 1' to tail call, and return correct matchedIdx value from 'helpNextMatch' function by adding 1 rather than subtracting
This commit is contained in:
@@ -15,7 +15,7 @@ struct
|
|||||||
if hdChr = searchChr then
|
if hdChr = searchChr then
|
||||||
if matchedChrs + 1 = String.size searchString then
|
if matchedChrs + 1 = String.size searchString then
|
||||||
let
|
let
|
||||||
val matchedIdx = absIdx - String.size searchString - 1
|
val matchedIdx = absIdx - String.size searchString + 1
|
||||||
in
|
in
|
||||||
SOME matchedIdx
|
SOME matchedIdx
|
||||||
end
|
end
|
||||||
@@ -57,7 +57,7 @@ struct
|
|||||||
val searchList = SearchList.append (matchedIdx, searchList)
|
val searchList = SearchList.append (matchedIdx, searchList)
|
||||||
in
|
in
|
||||||
helpBuild
|
helpBuild
|
||||||
(app, origIdx, matchedIdx, buffer, searchString, searchList)
|
(app, origIdx, matchedIdx + 1, buffer, searchString, searchList)
|
||||||
end
|
end
|
||||||
| NONE =>
|
| NONE =>
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user