diff --git a/fcore/text-builder/text-builder-with-cursor.sml b/fcore/text-builder/text-builder-with-cursor.sml index 48c5863..cc9b3a6 100644 --- a/fcore/text-builder/text-builder-with-cursor.sml +++ b/fcore/text-builder/text-builder-with-cursor.sml @@ -3,6 +3,11 @@ struct structure TC = TextConstants structure Utils = TextBuilderUtils + fun isSecondLastChr (pos, str, tl) = + case tl of + [] => pos = String.size str - 2 + | _ => false + fun goToFirstLineAfter (stl, ltl, posY, lineNumber, absIdx, cursorIdx, env, acc) = case (stl, ltl) of @@ -135,6 +140,11 @@ struct #"\n" => if lineNumber + 1 > #lastLineNumber env then acc + else if isSecondLastChr (pos, str, stl) then + if absIdx = cursorIdx then + Utils.makeCursor (#startX env, posY + TC.ySpace, env) :: acc + else + acc else let val acc = diff --git a/fcore/text-builder/text-builder-with-highlight.sml b/fcore/text-builder/text-builder-with-highlight.sml index ce8daea..b038b0c 100644 --- a/fcore/text-builder/text-builder-with-highlight.sml +++ b/fcore/text-builder/text-builder-with-highlight.sml @@ -3,6 +3,11 @@ struct structure TC = TextConstants structure Utils = TextBuilderUtils + fun isSecondLastChr (pos, str, tl) = + case tl of + [] => pos = String.size str - 2 + | _ => false + fun goToFirstLineAfter (stl, ltl, posY, lineNumber, absIdx, cursorIdx, env, acc, searchPos) = case (stl, ltl) of @@ -232,6 +237,11 @@ struct | #"\n" => if lineNumber + 1 > #lastLineNumber env then acc + else if isSecondLastChr (pos, str, stl) then + if absIdx = cursorIdx then + Utils.makeCursor (#startX env, posY + TC.ySpace, env) :: acc + else + acc else let val acc =