@@ -92,17 +92,17 @@ impl View {
92 let line = pos.row;
92 let line = pos.row;
93 let col = pos.col;
93 let col = pos.col;
94 let height = self.area.height.saturating_sub(1); // - 1 for statusline
94 let height = self.area.height.saturating_sub(1); // - 1 for statusline
95− let last_line = self.first_line + height as usize;
95+ let last_line = (self.first_line + height as usize).saturating_sub(1);
97 let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref
97 let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref
99 // TODO: not ideal
99 // TODO: not ideal
100 const OFFSET: usize = 7; // 1 diagnostic + 5 linenr + 1 gutter
100 const OFFSET: usize = 7; // 1 diagnostic + 5 linenr + 1 gutter
101− let last_col = self.first_col + (self.area.width as usize - OFFSET);
101+ let last_col = (self.first_col + self.area.width as usize).saturating_sub(OFFSET + 1);
103− if line > last_line.saturating_sub(scrolloff + 1) {
103+ if line > last_line.saturating_sub(scrolloff) {
104 // scroll down
104 // scroll down
105− self.first_line += line - (last_line.saturating_sub(scrolloff + 1));
105+ self.first_line += line - (last_line.saturating_sub(scrolloff));
106 } else if line < self.first_line + scrolloff {
106 } else if line < self.first_line + scrolloff {
107 // scroll up
107 // scroll up
108 self.first_line = line.saturating_sub(scrolloff);
108 self.first_line = line.saturating_sub(scrolloff);