add TextScroll function for centering line to cursor, and use it in 'NormalFinish.centreToCursor' function

This commit is contained in:
2025-09-13 18:23:55 +01:00
parent 18d2579605
commit 7a388f2983
2 changed files with 9 additions and 4 deletions

View File

@@ -34,7 +34,6 @@ struct
(* cursorLine > prevLineNumber *)
let
val howManyLinesWeCanFit = windowHeight div TC.ySpace
val howManyLinesWeCanFit = howManyLinesWeCanFit
in
if cursorLine > prevLineNumber + (howManyLinesWeCanFit - 3) then
(* cursorLine is after the visible part of the screen
@@ -43,4 +42,12 @@ struct
else
prevLineNumber
end
fun getLineCentre (cursorLine, windowHeight) =
let
val howManyLinesWeCanFit = windowHeight div TC.ySpace
val startLine = cursorLine - (howManyLinesWeCanFit div 2)
in
Int.max (startLine, 0)
end
end