Closed benjamin-travis-summers closed 7 years ago
-- | Move cursor to the bottom of the screen
scrollCursorToBottomB :: BufferM ()
scrollCursorToBottomB = do
MarkSet _ i _ <- markLines
r <- winRegionB
t <- lineOf (regionEnd r - 1)
scrollB $ i - t
The problem seems to be regionEnd
is the last point in the buffer, not the last square on the screen.
I guess the right approach is to figure out which line of the screen the cursor is on, find the height of the window, and use those two values to figure out how many lines to scroll down?
Sort of fixed by https://github.com/yi-editor/yi/pull/1029. Scrolling is off by amount of newly displayed wrapped lines, but I don't have a simple solution for that.
To reproduce, go to the end of a buffer (
G
), and move the view down so that the last line of text is the first line on the screen (zt
). From this state, enteringzb
should move the view so that the last line of text is the last line on the screen, but nothing happens.(Possibly enlightening behavior: If the cursor is $x lines above the last line of the buffer, entering
zb
will move the view up $x lines.)