pass 'maxLength' value to TextScroll function so that we can prevent scrolling past the bottom of the file (unless we want to od so by centtering the screen)
This commit is contained in:
@@ -37,7 +37,7 @@ struct
|
||||
fun getScrollColumnFromString (cursorIdx, windowWidth, prevScrollColumn) =
|
||||
calculateScrollColumn (0, cursorIdx, windowWidth, prevScrollColumn)
|
||||
|
||||
fun getStartLine (prevLineNumber, cursorLine, windowHeight) =
|
||||
fun getStartLine (prevLineNumber, cursorLine, windowHeight, totalLines) =
|
||||
if cursorLine <= (prevLineNumber + 3) then
|
||||
(* cursorLine is prior to or same as prevLineNumber,
|
||||
* so use cursorLine to calculate the start line we want. *)
|
||||
@@ -50,7 +50,10 @@ struct
|
||||
if cursorLine > prevLineNumber + (howManyLinesWeCanFit - 3) then
|
||||
(* cursorLine is after the visible part of the screen
|
||||
* so return the mimimum line where cursorLine is visible *)
|
||||
cursorLine - howManyLinesWeCanFit + 3
|
||||
if cursorLine >= totalLines - 3 then
|
||||
Int.max (totalLines - howManyLinesWeCanFit, 0)
|
||||
else
|
||||
cursorLine - howManyLinesWeCanFit + 3
|
||||
else
|
||||
prevLineNumber
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user