fix bug where some lines were not scrolling horizontally properly. The issue was that, when encountering a line break in 'skipToFirstVisualColumn' function, we should have recursively called the 'skipToFirstVisualColumn' function instead of the 'build' function. The reason is that our current column after a line break is 0, but we don't know if the start column to display is necessarily 0 in all cases.
This commit is contained in:
@@ -15,13 +15,12 @@ struct
|
||||
val posY = posY + TC.ySpace
|
||||
val lineNumber = lineNumber + 1
|
||||
in
|
||||
build
|
||||
skipToFirstVisibleColumn
|
||||
( strPos
|
||||
, shd
|
||||
, stl
|
||||
, lhd
|
||||
, ltl
|
||||
, #startX env
|
||||
, posY
|
||||
, 0
|
||||
, lineNumber
|
||||
@@ -78,13 +77,12 @@ struct
|
||||
val posY = posY + TC.ySpace
|
||||
val lineNumber = lineNumber + 1
|
||||
in
|
||||
build
|
||||
skipToFirstVisibleColumn
|
||||
( newStrPos
|
||||
, str
|
||||
, stl
|
||||
, line
|
||||
, ltl
|
||||
, #startX env
|
||||
, posY
|
||||
, 0
|
||||
, lineNumber
|
||||
@@ -150,19 +148,23 @@ struct
|
||||
case String.sub (str, pos) of
|
||||
#"\n" =>
|
||||
let
|
||||
(* increment line lineNumber and posY, and then call build function *)
|
||||
(* increment line lineNumber and posY,
|
||||
* and then call skipToFirstVisibleColumn recursively.
|
||||
* The recursive call check this condition:
|
||||
* Is the new column 0 the same as the column the scroll starts at?
|
||||
* If it is, then we call build, or else we continue skipping
|
||||
* until we reach the start column. *)
|
||||
val posY = posY + TC.ySpace
|
||||
val lineNumber = lineNumber + 1
|
||||
in
|
||||
build
|
||||
skipToFirstVisibleColumn
|
||||
( pos + 1
|
||||
, str
|
||||
, stl
|
||||
, line
|
||||
, ltl
|
||||
, #startX env
|
||||
, posY
|
||||
, #scrollColumnStart env
|
||||
, 0
|
||||
, lineNumber
|
||||
, absIdx + 1
|
||||
, cursorIdx
|
||||
|
||||
Reference in New Issue
Block a user