fix type errors in normal-mode-text-builder.sml
This commit is contained in:
@@ -13,7 +13,7 @@ struct
|
||||
|
||||
fun isEmpty t =
|
||||
case t of
|
||||
LEAF (_, sizes) = Vector.length sizes = 0
|
||||
LEAF (_, sizes) => Vector.length sizes = 0
|
||||
| _ => false
|
||||
|
||||
val empty = LEAF (#[], #[])
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
structure SearchList =
|
||||
struct
|
||||
type t = int vector
|
||||
|
||||
val empty = PersistentVector.empty
|
||||
|
||||
fun backtrackFull (pos, hd, absIdx, tl, acc, searchPos, searchString, prevTl) =
|
||||
@@ -87,12 +85,12 @@ struct
|
||||
case rightStrings of
|
||||
hd :: tl =>
|
||||
loopSearch (0, hd, 0, tl, PersistentVector.empty, 0, searchString, [])
|
||||
| [] => empty
|
||||
| [] => PersistentVector.empty
|
||||
|
||||
(* Prerequisite: move buffer/LineGap to start *)
|
||||
fun build (buffer, searchString) =
|
||||
if String.size searchString > 0 then search (buffer, searchString)
|
||||
else empty
|
||||
else PersistentVector.empty
|
||||
|
||||
fun backtrackRange
|
||||
(pos, hd, absIdx, tl, acc, searchPos, searchString, finish, prevTl) =
|
||||
@@ -235,7 +233,7 @@ struct
|
||||
, finish
|
||||
, []
|
||||
)
|
||||
| [] => empty
|
||||
| [] => PersistentVector.empty
|
||||
end
|
||||
|
||||
fun buildRange (buffer, searchString, finishIdx) =
|
||||
@@ -244,9 +242,9 @@ struct
|
||||
SOME nfa =>
|
||||
Nfa.getMatchesInRange
|
||||
(#idx buffer, finishIdx, buffer : LineGap.t, nfa)
|
||||
| NONE => empty
|
||||
| NONE => PersistentVector.empty
|
||||
else
|
||||
empty
|
||||
PersistentVector.empty
|
||||
|
||||
fun loopNextMatch (pos, searchList, count) =
|
||||
if count = 0 then
|
||||
|
||||
@@ -58,27 +58,39 @@ struct
|
||||
(startLine, curLine, lhd)
|
||||
(* get absolute idx of line *)
|
||||
val absIdx = curIdx + strPos
|
||||
|
||||
val searchPos = BinSearch.equalOrMore (absIdx, searchList)
|
||||
val searchPos =
|
||||
if searchPos = ~1 then Vector.length searchList else searchPos
|
||||
in
|
||||
TextBuilderWithHighlight.build
|
||||
( strPos
|
||||
, shd
|
||||
, stl
|
||||
, lhd
|
||||
, ltl
|
||||
, startX
|
||||
, startY
|
||||
, 0
|
||||
, startLine
|
||||
, absIdx
|
||||
, cursorPos
|
||||
, env
|
||||
, acc
|
||||
, searchPos
|
||||
)
|
||||
if PersistentVector.isEmpty searchList then
|
||||
TextBuilderWithCursor.build
|
||||
( strPos
|
||||
, shd
|
||||
, stl
|
||||
, lhd
|
||||
, ltl
|
||||
, startX
|
||||
, startY
|
||||
, 0
|
||||
, startLine
|
||||
, absIdx
|
||||
, cursorPos
|
||||
, env
|
||||
, acc
|
||||
)
|
||||
else
|
||||
TextBuilderWithHighlight.build
|
||||
( strPos
|
||||
, shd
|
||||
, stl
|
||||
, lhd
|
||||
, ltl
|
||||
, startX
|
||||
, startY
|
||||
, 0
|
||||
, startLine
|
||||
, absIdx
|
||||
, cursorPos
|
||||
, env
|
||||
, acc
|
||||
)
|
||||
end
|
||||
| (_, _) => acc
|
||||
end
|
||||
@@ -89,7 +101,7 @@ struct
|
||||
, buffer: LineGap.t
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, searchList: SearchList.t
|
||||
, searchList
|
||||
, visualScrollColumn
|
||||
, acc
|
||||
) =
|
||||
@@ -112,7 +124,7 @@ struct
|
||||
, buffer: LineGap.t
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, searchList: SearchList.t
|
||||
, searchList
|
||||
, visualScrollColumn
|
||||
) =
|
||||
startBuild
|
||||
|
||||
Reference in New Issue
Block a user