This commit is contained in:
Stephan Dilly 2021-06-06 00:36:28 +02:00
parent ae5ed8ac00
commit bcc0e16208
5 changed files with 10 additions and 9 deletions

View file

@ -402,7 +402,7 @@ impl BranchListComponent {
for (i, displaybranch) in self
.branches
.iter()
.skip(self.scroll.get())
.skip(self.scroll.get_top())
.take(height)
.enumerate()
{
@ -430,8 +430,9 @@ impl BranchListComponent {
branch_name += THREE_DOTS;
}
let selected =
(self.selection as usize - self.scroll.get()) == i;
let selected = (self.selection as usize
- self.scroll.get_top())
== i;
let is_head = displaybranch
.local_details()

View file

@ -140,7 +140,7 @@ impl DetailsComponent {
.concat()
.iter()
.enumerate()
.skip(self.scroll.get())
.skip(self.scroll.get_top())
.take(height)
.map(|(i, line)| {
Spans::from(vec![Span::styled(

View file

@ -337,7 +337,7 @@ impl DiffComponent {
Span::raw(Cow::from(")")),
])]);
} else {
let min = self.scroll.get();
let min = self.scroll.get_top();
let max = min + height as usize;
let mut line_cursor = 0_usize;

View file

@ -182,7 +182,7 @@ impl RevisionFilesComponent {
let items = self
.tree
.iterate(self.scroll.get(), tree_height)
.iterate(self.scroll.get_top(), tree_height)
.map(|(item, selected)| {
Self::tree_item_to_span(item, &self.theme, selected)
});

View file

@ -20,7 +20,7 @@ impl VerticalScroll {
}
}
pub fn get(&self) -> usize {
pub fn get_top(&self) -> usize {
self.top.get()
}
@ -58,7 +58,7 @@ impl VerticalScroll {
visual_height: usize,
) -> usize {
let new_top = calc_scroll_top(
self.get(),
self.get_top(),
visual_height,
selection,
selection_max,
@ -76,7 +76,7 @@ impl VerticalScroll {
line_count: usize,
visual_height: usize,
) -> usize {
self.update(self.get(), line_count, visual_height)
self.update(self.get_top(), line_count, visual_height)
}
pub fn draw<B: Backend>(