in TextBuilder functions, when we encounter a newline, we want any cursor here to be drawn after a linebreak (after the posX and posY values go to the next line) and not before

This commit is contained in:
2025-09-16 22:29:19 +01:00
parent 1adb74df2c
commit 97936b83a0
2 changed files with 31 additions and 30 deletions

View File

@@ -133,26 +133,26 @@ struct
else else
case String.sub (str, pos) of case String.sub (str, pos) of
#"\n" => #"\n" =>
if lineNumber + 1 > #lastLineNumber env then
acc
else
let let
val posX = #startX env
val posY = posY + TC.ySpace
val acc = val acc =
if absIdx = cursorIdx then if absIdx = cursorIdx then
Utils.makeCursor (posX, posY, env) :: acc Utils.makeCursor (posX, posY, env) :: acc
else else
acc acc
val nextLineNumber = lineNumber + 1
in in
if nextLineNumber > #lastLineNumber env then
acc
else
build build
( pos + 1 ( pos + 1
, str , str
, stl , stl
, line , line
, ltl , ltl
, #startX env , posX
, posY + TC.ySpace , posY
, 0 , 0
, lineNumber + 1 , lineNumber + 1
, absIdx + 1 , absIdx + 1

View File

@@ -230,27 +230,28 @@ struct
) )
end end
| #"\n" => | #"\n" =>
if lineNumber + 1 > #lastLineNumber env then
acc
else
let let
val posX = #startX env
val posY = posY + TC.ySpace
val acc = val acc =
if absIdx = cursorIdx then if absIdx = cursorIdx then
Utils.makeCursor (posX, posY, env) :: acc Utils.makeCursor (posX, posY, env) :: acc
else else
acc acc
val nextLineNumber = lineNumber + 1
in in
if nextLineNumber > #lastLineNumber env then
acc
else
build build
( pos + 1 ( pos + 1
, str , str
, stl , stl
, line , line
, ltl , ltl
, #startX env , posX
, posY + TC.ySpace , posY
, 0 , 0
, nextLineNumber , lineNumber + 1
, absIdx + 1 , absIdx + 1
, cursorIdx , cursorIdx
, env , env