diff options
author | Canop <cano.petrole@gmail.com> | 2021-09-05 19:05:20 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-09-05 19:05:20 +0200 |
commit | c2848b6bd433a4e623456ecf217d0cf9843bd491 (patch) | |
tree | 096077182d2a94cbff707a47f9bb79f8f396de3e /src/display | |
parent | 1c321d4f287b3752dea62fa250ccc54cb16e8f7c (diff) |
upgrade termimad to 0.16
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/displayable_tree.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/display/displayable_tree.rs b/src/display/displayable_tree.rs index 7e5fd35..6bd5b72 100644 --- a/src/display/displayable_tree.rs +++ b/src/display/displayable_tree.rs @@ -25,7 +25,7 @@ use { file_size, git2::Status, std::io::Write, - termimad::{CompoundStyle, ProgressBar}, + termimad::{Area, CompoundStyle, ProgressBar}, }; /// A tree wrapper which can be used either @@ -451,7 +451,12 @@ impl<'a, 's, 't> DisplayableTree<'a, 's, 't> { let tree = self.tree; let total_size = tree.total_sum(); let scrollbar = if self.in_app { - self.area.scrollbar(tree.scroll, tree.lines.len() as i32 - 1) + termimad::compute_scrollbar( + tree.scroll, + tree.lines.len() - 1, // the root line isn't scrolled + self.area.height - 1, // the scrollbar doesn't cover the first line + self.area.top + 1, + ) } else { None }; @@ -602,7 +607,7 @@ impl<'a, 's, 't> DisplayableTree<'a, 's, 't> { } self.extend_line_bg(cw, selected)?; self.skin.queue_reset(f)?; - if self.in_app && y > 0 { + if self.in_app { if let Some((sctop, scbottom)) = scrollbar { f.queue(cursor::MoveTo(self.area.left + self.area.width - 1, y))?; let style = if sctop <= y && y <= scbottom { |