done implementing one text builder function
This commit is contained in:
@@ -121,7 +121,8 @@ struct
|
|||||||
, posX
|
, posX
|
||||||
, posY
|
, posY
|
||||||
, column
|
, column
|
||||||
, lineNumber absIdx
|
, lineNumber
|
||||||
|
, absIdx
|
||||||
, cursorIdx
|
, cursorIdx
|
||||||
, env
|
, env
|
||||||
, acc
|
, acc
|
||||||
@@ -141,11 +142,83 @@ struct
|
|||||||
, env
|
, env
|
||||||
, acc
|
, acc
|
||||||
)
|
)
|
||||||
else if lineNumber > #lastLineNumber env then
|
|
||||||
acc
|
|
||||||
else
|
else
|
||||||
case String.sub (str, pos) of
|
case String.sub (str, pos) of
|
||||||
chr => raise Fail "unimplemented"
|
#" " =>
|
||||||
|
let
|
||||||
|
val acc =
|
||||||
|
if absIdx = cursorIdx then makeCursor (posX, posY, env) :: acc
|
||||||
|
else acc
|
||||||
|
in
|
||||||
|
buildTextString
|
||||||
|
( pos + 1
|
||||||
|
, str
|
||||||
|
, stl
|
||||||
|
, line
|
||||||
|
, ltl
|
||||||
|
, posX + TC.xSpace
|
||||||
|
, posY
|
||||||
|
, column + 1
|
||||||
|
, lineNumber
|
||||||
|
, absIdx + 1
|
||||||
|
, cursorIdx
|
||||||
|
, env
|
||||||
|
, acc
|
||||||
|
)
|
||||||
|
end
|
||||||
|
| #"\n" =>
|
||||||
|
let
|
||||||
|
val acc =
|
||||||
|
if absIdx = cursorIdx then makeCursor (posX, posY, env) :: acc
|
||||||
|
else acc
|
||||||
|
|
||||||
|
val nextLineNumber = lineNumber + 1
|
||||||
|
in
|
||||||
|
if nextLineNumber > #lastLineNumber env then
|
||||||
|
acc
|
||||||
|
else
|
||||||
|
buildTextString
|
||||||
|
( pos + 1
|
||||||
|
, str
|
||||||
|
, stl
|
||||||
|
, line
|
||||||
|
, ltl
|
||||||
|
, #startX env
|
||||||
|
, posY + TC.ySpace
|
||||||
|
, 0
|
||||||
|
, lineNumber + 1
|
||||||
|
, absIdx + 1
|
||||||
|
, cursorIdx
|
||||||
|
, env
|
||||||
|
, acc
|
||||||
|
)
|
||||||
|
end
|
||||||
|
| chr =>
|
||||||
|
let
|
||||||
|
val acc =
|
||||||
|
if absIdx = cursorIdx then
|
||||||
|
let val acc = makeCursor (posX, posY, env) :: acc
|
||||||
|
in makeCursorOnChr (chr, posX, posY, env) :: acc
|
||||||
|
end
|
||||||
|
else
|
||||||
|
makeCursor (chr, posX, posY, env) :: acc
|
||||||
|
in
|
||||||
|
buildTextString
|
||||||
|
( pos + 1
|
||||||
|
, str
|
||||||
|
, stl
|
||||||
|
, line
|
||||||
|
, ltl
|
||||||
|
, posX + TC.xSpace
|
||||||
|
, posY
|
||||||
|
, column + 1
|
||||||
|
, lineNumber
|
||||||
|
, absIdx + 1
|
||||||
|
, cursorIdx
|
||||||
|
, env
|
||||||
|
, acc
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
fun buildTextString
|
fun buildTextString
|
||||||
( pos
|
( pos
|
||||||
|
|||||||
Reference in New Issue
Block a user