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

@@ -128,7 +128,6 @@ struct
)
end
(* todo: check; the way we get the startLine is almost certainly wrong *)
fun centreToCursor (app: app_type) =
let
val
@@ -146,8 +145,7 @@ struct
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val cursorLine = LineGap.getLineNumberOfIdx (cursorIdx, buffer)
val startLine =
TextScroll.getStartLine (prevLineNumber, cursorLine, windowHeight div 2)
val startLine = TextScroll.getLineCentre (cursorLine, windowHeight)
val buffer = LineGap.goToLine (startLine, buffer)
val drawMsg = NormalModeTextBuilder.build