summaryrefslogtreecommitdiffstats
path: root/src/hex
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-09-05 19:05:20 +0200
committerCanop <cano.petrole@gmail.com>2021-09-05 19:05:20 +0200
commitc2848b6bd433a4e623456ecf217d0cf9843bd491 (patch)
tree096077182d2a94cbff707a47f9bb79f8f396de3e /src/hex
parent1c321d4f287b3752dea62fa250ccc54cb16e8f7c (diff)
upgrade termimad to 0.16
Diffstat (limited to 'src/hex')
-rw-r--r--src/hex/hex_view.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/hex/hex_view.rs b/src/hex/hex_view.rs
index 8a7141a..40c072d 100644
--- a/src/hex/hex_view.rs
+++ b/src/hex/hex_view.rs
@@ -145,7 +145,7 @@ impl HexView {
margin_around_adresses = true;
//rem -= 2;
}
- let scrollbar = area.scrollbar(self.scroll as i32, self.line_count() as i32);
+ let scrollbar = area.scrollbar(self.scroll, self.line_count());
let scrollbar_fg = styles.scrollbar_thumb.get_fg()
.or_else(|| styles.preview.get_fg())
.unwrap_or(Color::White);
@@ -201,7 +201,7 @@ impl HexView {
}
}
cw.fill(&styles.default, &SPACE_FILLING)?;
- if is_thumb(y, scrollbar) {
+ if is_thumb(y as u16 + area.top, scrollbar) {
w.queue(SetForegroundColor(scrollbar_fg))?;
w.queue(Print('▐'))?;
} else {
@@ -237,9 +237,8 @@ impl HexView {
}
}
-fn is_thumb(y: usize, scrollbar: Option<(u16, u16)>) -> bool {
+fn is_thumb(y: u16, scrollbar: Option<(u16, u16)>) -> bool {
if let Some((sctop, scbottom)) = scrollbar {
- let y = y as u16;
if sctop <= y && y <= scbottom {
return true;
}