Skip to content

Commit 63630eb

Browse files
author
Stephan Dilly
committed
cleanup
1 parent 65ff08e commit 63630eb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tabs/revlog/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,22 @@ impl Revlog {
112112
.unwrap()
113113
.max(1);
114114

115+
let page_offset =
116+
usize::from(self.current_height).saturating_sub(1);
117+
115118
self.selection = match scroll {
116119
ScrollType::Up => {
117120
self.selection.saturating_sub(speed_int)
118121
}
119122
ScrollType::Down => {
120123
self.selection.saturating_add(speed_int)
121124
}
122-
ScrollType::PageUp => self.selection.saturating_sub(
123-
usize::from(self.current_height).saturating_sub(1),
124-
),
125-
ScrollType::PageDown => self.selection.saturating_add(
126-
usize::from(self.current_height).saturating_sub(1),
127-
),
125+
ScrollType::PageUp => {
126+
self.selection.saturating_sub(page_offset)
127+
}
128+
ScrollType::PageDown => {
129+
self.selection.saturating_add(page_offset)
130+
}
128131
ScrollType::Home => 0,
129132
ScrollType::End => self.selection_max,
130133
};

0 commit comments

Comments
 (0)