in TextBuilder.build functions, when we encounter a space, check if we are before the scroll column's start, and set the x position to startX if so. This is done in preparation for the character which is actually at the scroll column's start, which will be added at the wrong offset unless we do this.

This commit is contained in:
2025-09-14 08:42:46 +01:00
parent 120568a18d
commit 4bc6c54951
2 changed files with 13 additions and 2 deletions

View File

@@ -168,6 +168,14 @@ struct
Utils.makeCursor (posX, posY, env) :: acc Utils.makeCursor (posX, posY, env) :: acc
else else
acc acc
val posX =
if column < #scrollColumnStart env then
(* if we are prior to the start column,
* we want to set the x position to be at the start
* in preparation for when we are at the start column *)
#startX env
else
posX + TC.xSpace
in in
build build
( pos + 1 ( pos + 1
@@ -175,7 +183,7 @@ struct
, stl , stl
, line , line
, ltl , ltl
, posX + TC.xSpace , posX
, posY , posY
, column + 1 , column + 1
, lineNumber , lineNumber

View File

@@ -208,6 +208,9 @@ struct
Utils.makeHighlight (posX, posY, env) :: acc Utils.makeHighlight (posX, posY, env) :: acc
else else
acc acc
val posX =
if column < #scrollColumnStart env then #startX env
else posX + TC.xSpace
in in
build build
( pos + 1 ( pos + 1
@@ -215,7 +218,7 @@ struct
, stl , stl
, line , line
, ltl , ltl
, posX + TC.xSpace , posX
, posY , posY
, column + 1 , column + 1
, lineNumber , lineNumber