Skip to content

Commit b352452

Browse files
committed
simplify get/set VerticallScroll::visual_height
1 parent 9e369e4 commit b352452

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/components/commit_details/details.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ impl DrawableComponent for DetailsComponent {
285285
let height = chunks[1].height.saturating_sub(border_width);
286286

287287
self.current_size.set((width, height));
288-
self.scroll.set_visual_height(usize::from(height));
289288

290289
let number_of_lines = Self::get_number_of_lines(
291290
self.data.as_ref(),

src/components/utils/scroll_vertical.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ impl VerticalScroll {
2020
}
2121
}
2222

23-
pub fn set_visual_height(&self, height: usize) {
24-
self.visual_height.set(height);
25-
}
26-
27-
pub fn get_visual_height(&self) -> usize {
28-
self.visual_height.get()
29-
}
30-
3123
pub fn get_top(&self) -> usize {
3224
self.top.get()
3325
}
@@ -44,10 +36,10 @@ impl VerticalScroll {
4436
ScrollType::Down => old.saturating_add(1),
4537
ScrollType::Up => old.saturating_sub(1),
4638
ScrollType::PageDown => old
47-
.saturating_add(self.get_visual_height())
39+
.saturating_add(self.visual_height.get())
4840
.saturating_sub(1),
4941
ScrollType::PageUp => old
50-
.saturating_sub(self.get_visual_height())
42+
.saturating_sub(self.visual_height.get())
5143
.saturating_add(1),
5244
ScrollType::Home => 0,
5345
ScrollType::End => max,
@@ -96,6 +88,8 @@ impl VerticalScroll {
9688
selection_max: usize,
9789
visual_height: usize,
9890
) -> usize {
91+
self.visual_height.set(visual_height);
92+
9993
let new_top = calc_scroll_top(
10094
self.get_top(),
10195
visual_height,

0 commit comments

Comments
 (0)