fixed two issues. First is that an exception occurred when sometimes moving cursor forwards. Cause of this issue was that callee functions depended on LineGap being moved to start of line, but this did not always happen (and now it does always happen). Second issue was that moving cursor down did not scroll as expected when line wrapped. The reason for this second issue was that the 'getStartLineAfter' function did not increment 'startLine' value in loop when line wrap occurred. Both issues are now fixed.

This commit is contained in:
2024-10-28 22:54:28 +00:00
parent bff4c006ed
commit 5e1e39ca69
3 changed files with 15 additions and 10 deletions

View File

@@ -65,7 +65,7 @@ struct
if curHeight + (ySpace * 3) >= maxHeight then
getStartLineAfter
( sIdx + 1, shd, lineNum + 1, absIdx + 1, cursorIdx, stl
, maxWidth, maxHeight, 0, 0
, maxWidth, maxHeight, 0, curHeight + ySpace
, origLine + 1
)
else
@@ -90,13 +90,13 @@ struct
if curHeight + (ySpace * 3) >= maxHeight then
getStartLineAfter
( sIdx + 1, shd, lineNum + 1, absIdx + 1, cursorIdx, stl
, maxWidth, maxHeight, 0, 0
, maxWidth, maxHeight, 0, curHeight + ySpace
, origLine + 1
)
else
getStartLineAfter
( sIdx + 1, shd, lineNum + 1, absIdx + 1, cursorIdx, stl
, maxWidth, maxHeight, 0, 0
, maxWidth, maxHeight, 0, curHeight + ySpace
, origLine
)
end
@@ -132,12 +132,11 @@ struct
(startIdx + 1, rStrHd, oldLine, absIdx + 1, cursorIdx, leftStrings)
else if cursorIdx > absIdx then
(* possibly move downwards *)
let val _ = print "start 133\n" in
getStartLineAfter
( startIdx, rStrHd, oldLine, absIdx, cursorIdx, rStrTl
, maxWidth, maxHeight, 0, 0
, oldLine
) end
)
else
(* keep current line *)
Int.max (oldLine - 1, 0)