Fixing scrollbar view content
This commit is contained in:
parent
000e31a14f
commit
60e4fa3b9d
2 changed files with 14 additions and 10 deletions
|
|
@ -178,17 +178,21 @@ impl App {
|
|||
return;
|
||||
}
|
||||
|
||||
let max_scroll = state
|
||||
.get_total_lenght()
|
||||
.saturating_sub(area[0].height as usize)
|
||||
.saturating_add(1);
|
||||
|
||||
state.scroll_state = state
|
||||
.scroll_state
|
||||
.content_length(max_scroll.max(1))
|
||||
.viewport_content_length(area[0].height as usize);
|
||||
|
||||
let scrollbar = Scrollbar::new(ScrollbarOrientation::VerticalRight)
|
||||
.begin_symbol(Some("↑"))
|
||||
.end_symbol(Some("↓"));
|
||||
|
||||
frame.render_stateful_widget(
|
||||
scrollbar,
|
||||
area[1],
|
||||
&mut state
|
||||
.scroll_state
|
||||
.viewport_content_length(area[0].height as usize),
|
||||
);
|
||||
frame.render_stateful_widget(scrollbar, area[1], &mut state.scroll_state);
|
||||
}
|
||||
|
||||
fn handle_events(&mut self) -> io::Result<()> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue