additional functorisation progress
This commit is contained in:
@@ -826,35 +826,42 @@ struct
|
|||||||
fun toNextChr (lineGap, cursorIdx, chr) =
|
fun toNextChr (lineGap, cursorIdx, chr) =
|
||||||
nextChr (lineGap, cursorIdx, chr, startToNextChr)
|
nextChr (lineGap, cursorIdx, chr, startToNextChr)
|
||||||
|
|
||||||
fun helpToPrevChr (strPos, str, absIdx, stl, ltl, origIdx, findChr) =
|
structure ToPrevChr =
|
||||||
|
MakeIfCharFolderPrev
|
||||||
|
(struct
|
||||||
|
type env = char
|
||||||
|
|
||||||
|
fun helpToPrevChr (strPos, str, absIdx, stl, origIdx, findChr) =
|
||||||
if strPos < 0 then
|
if strPos < 0 then
|
||||||
case (stl, ltl) of
|
case stl of
|
||||||
(shd :: stl, lhd :: ltl) =>
|
shd :: stl =>
|
||||||
helpToPrevChr
|
helpToPrevChr
|
||||||
(String.size shd - 1, shd, absIdx, stl, ltl, origIdx, findChr)
|
(String.size shd - 1, shd, absIdx, stl, origIdx, findChr)
|
||||||
| (_, _) => origIdx
|
| [] => origIdx
|
||||||
else if String.sub (str, strPos) = findChr then
|
else if String.sub (str, strPos) = findChr then
|
||||||
absIdx
|
absIdx
|
||||||
else
|
else
|
||||||
helpToPrevChr (strPos - 1, str, absIdx - 1, stl, ltl, origIdx, findChr)
|
helpToPrevChr (strPos - 1, str, absIdx - 1, stl, origIdx, findChr)
|
||||||
|
|
||||||
fun startToPrevChr (shd, strIdx, absIdx, stl, ltl, findChr) =
|
fun fStart (strIdx, shd, _, absIdx, stl, _, findChr) =
|
||||||
(* we want to start iterating from Prev char after strIdx *)
|
(* we want to start iterating from Prev char after strIdx *)
|
||||||
if strIdx > 0 then
|
if strIdx > 0 then
|
||||||
helpToPrevChr (strIdx - 1, shd, absIdx - 1, stl, ltl, absIdx, findChr)
|
helpToPrevChr (strIdx - 1, shd, absIdx - 1, stl, absIdx, findChr)
|
||||||
else
|
else
|
||||||
case (stl, ltl) of
|
case stl of
|
||||||
(stlhd :: stltl, ltlhd :: ltltl) =>
|
stlhd :: stltl =>
|
||||||
helpToPrevChr
|
helpToPrevChr
|
||||||
( String.size stlhd - 1
|
( String.size stlhd - 1
|
||||||
, stlhd
|
, stlhd
|
||||||
, absIdx - 1
|
, absIdx - 1
|
||||||
, stltl
|
, stltl
|
||||||
, ltltl
|
|
||||||
, absIdx
|
, absIdx
|
||||||
, findChr
|
, findChr
|
||||||
)
|
)
|
||||||
| (_, _) => (* tl is empty; return 0 for lineGap start *) 0
|
| [] => (* tl is empty; return 0 for lineGap start *) 0
|
||||||
|
end)
|
||||||
|
|
||||||
|
val toPrevChr = ToPrevChr.foldPrev
|
||||||
|
|
||||||
fun helpTillPrevChr
|
fun helpTillPrevChr
|
||||||
( strPos
|
( strPos
|
||||||
@@ -994,9 +1001,6 @@ struct
|
|||||||
| (_, _) => cursorIdx
|
| (_, _) => cursorIdx
|
||||||
end
|
end
|
||||||
|
|
||||||
fun toPrevChr (lineGap, cursorIdx, chr) =
|
|
||||||
prevChr (lineGap, cursorIdx, chr, startToPrevChr)
|
|
||||||
|
|
||||||
fun tillPrevChr (lineGap, cursorIdx, chr) =
|
fun tillPrevChr (lineGap, cursorIdx, chr) =
|
||||||
prevChr (lineGap, cursorIdx, chr, startTillPrevChr)
|
prevChr (lineGap, cursorIdx, chr, startTillPrevChr)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user