Fix the last line calculation inside ensure_cursor_in_view

This commit is contained in:
Blaž Hrastnik 2021-04-14 17:15:32 +09:00
parent c64240b6ef
commit b5b650cfe7

View File

@ -81,7 +81,8 @@ pub fn ensure_cursor_in_view(&mut self, doc: &Document) {
let pos = coords_at_pos(doc.text().slice(..), cursor);
let line = pos.row;
let col = pos.col;
let last_line = self.last_line(doc);
let height = self.area.height.saturating_sub(1); // - 1 for statusline
let last_line = self.first_line + height as usize;
let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref