Skip to content

Commit 5e2ccf9

Browse files
committed
make VerticalScroll::move_top for PageUp nicer
1 parent ef998e2 commit 5e2ccf9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/components/utils/scroll_vertical.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,11 @@ impl VerticalScroll {
3636
ScrollType::Down => old.saturating_add(1),
3737
ScrollType::Up => old.saturating_sub(1),
3838
ScrollType::PageDown => old
39-
.saturating_add(self.visual_height.get())
40-
.saturating_sub(1),
41-
ScrollType::PageUp => {
42-
if old < self.visual_height.get() {
43-
0
44-
} else {
45-
old.saturating_sub(self.visual_height.get())
46-
.saturating_add(1)
47-
}
48-
}
39+
.saturating_sub(1)
40+
.saturating_add(self.visual_height.get()),
41+
ScrollType::PageUp => old
42+
.saturating_add(1)
43+
.saturating_sub(self.visual_height.get()),
4944
ScrollType::Home => 0,
5045
ScrollType::End => max,
5146
};

0 commit comments

Comments
 (0)