minor adjustment to vertical TextScroll: we shouldn't need to move the cursor to the very line in the visible area, or the ver first line in the visible area, to scroll. We scroll if the cursorLine is some distance close to either edge instead.
This commit is contained in:
@@ -26,18 +26,20 @@ struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
fun getStartLine (prevLineNumber, cursorLine, windowHeight) =
|
fun getStartLine (prevLineNumber, cursorLine, windowHeight) =
|
||||||
if cursorLine <= prevLineNumber then
|
if cursorLine <= (prevLineNumber + 3) then
|
||||||
(* if cursorLine is prior or same as prevLineNumber,
|
(* cursorLine is prior to or same as prevLineNumber,
|
||||||
* then use cursorLine as scroll-line-start *)
|
* so use cursorLine to calculate the start line we want. *)
|
||||||
cursorLine
|
Int.max (cursorLine - 3, 0)
|
||||||
else
|
else
|
||||||
(* cursorLine > prevLineNumber *)
|
(* cursorLine > prevLineNumber *)
|
||||||
let
|
let
|
||||||
val howManyLinesWeCanFit = windowHeight div TC.ySpace
|
val howManyLinesWeCanFit = windowHeight div TC.ySpace
|
||||||
val howManyLinesWeCanFit = howManyLinesWeCanFit - 2
|
val howManyLinesWeCanFit = howManyLinesWeCanFit
|
||||||
in
|
in
|
||||||
if cursorLine > prevLineNumber + howManyLinesWeCanFit then
|
if cursorLine > prevLineNumber + (howManyLinesWeCanFit - 3) then
|
||||||
cursorLine - howManyLinesWeCanFit
|
(* cursorLine is after the visible part of the screen
|
||||||
|
* so return the mimimum line where cursorLine is visible *)
|
||||||
|
cursorLine - howManyLinesWeCanFit + 3
|
||||||
else
|
else
|
||||||
prevLineNumber
|
prevLineNumber
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user