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