Impose min scrollbar height in a way that doesn't impede scrollbar's movement

Also, fix the editor's scroll max so that you can scroll to the last
display row.
This commit is contained in:
Max Brunsfeld 2022-10-11 18:50:04 -07:00
parent 81a3a22379
commit 7eceff1d7b
2 changed files with 16 additions and 22 deletions

View file

@ -1271,7 +1271,7 @@ impl Editor {
let max_scroll_top = if matches!(self.mode, EditorMode::AutoHeight { .. }) {
(display_map.max_point().row() as f32 - visible_lines + 1.).max(0.)
} else {
display_map.max_point().row().saturating_sub(1) as f32
display_map.max_point().row() as f32
};
if scroll_position.y() > max_scroll_top {
scroll_position.set_y(max_scroll_top);