when looping through a DFA in a functor, make sure we return the absolute index to the calling function and not a modified version of the absolute index which has already been clipped
This commit is contained in:
@@ -147,7 +147,7 @@ struct
|
|||||||
if idx = String.size str then
|
if idx = String.size str then
|
||||||
case tl of
|
case tl of
|
||||||
str :: tl => foldNext (0, absIdx, str, tl, currentState, counter)
|
str :: tl => foldNext (0, absIdx, str, tl, currentState, counter)
|
||||||
| [] => Int.max (absIdx - 2, 0)
|
| [] => absIdx
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val chr = String.sub (str, idx)
|
val chr = String.sub (str, idx)
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ struct
|
|||||||
val {buffer, cursorIdx, searchList, bufferModifyTime, ...} = app
|
val {buffer, cursorIdx, searchList, bufferModifyTime, ...} = app
|
||||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
val cursorIdx = Fn.fMove (buffer, cursorIdx, count)
|
val cursorIdx = Fn.fMove (buffer, cursorIdx, count)
|
||||||
|
|
||||||
|
val textLength = #textLength buffer
|
||||||
|
val cursorIdx =
|
||||||
|
if cursorIdx >= textLength - 2 then Int.max (textLength - 2, 0)
|
||||||
|
else cursorIdx
|
||||||
in
|
in
|
||||||
NormalFinish.buildTextAndClear
|
NormalFinish.buildTextAndClear
|
||||||
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
(app, buffer, cursorIdx, searchList, [], bufferModifyTime)
|
||||||
|
|||||||
Reference in New Issue
Block a user