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" =>
let if lineNumber + 1 > #lastLineNumber env then
val acc = acc
if absIdx = cursorIdx then else
Utils.makeCursor (posX, posY, env) :: acc let
else val posX = #startX env
acc val posY = posY + TC.ySpace
val acc =
val nextLineNumber = lineNumber + 1 if absIdx = cursorIdx then
in Utils.makeCursor (posX, posY, env) :: acc
if nextLineNumber > #lastLineNumber env then else
acc acc
else in
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
@@ -160,7 +160,7 @@ struct
, env , env
, acc , acc
) )
end end
| #" " => | #" " =>
let let
val acc = val acc =

View File

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