in text builders, check when on newline if this is the second last character in the file, and draw it on a newline if so. This is to align with the design decision that we want the second-last character to be selectable

This commit is contained in:
2025-09-23 09:16:02 +01:00
parent 505521f5e2
commit 21e12addf3
2 changed files with 20 additions and 0 deletions

View File

@@ -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 =

View File

@@ -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 =