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

View File

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