scrolling up now try to only move the selection

This commit is contained in:
figsoda 2020-11-01 11:54:18 -05:00
parent 3221fcf1de
commit 25e6644f30
2 changed files with 7 additions and 4 deletions

View file

@ -19,7 +19,7 @@ pub fn render(
queue: &Vec<Track>,
status: &Status,
selected: usize,
liststate: &ListState,
liststate: &mut ListState,
) {
match widget {
Widget::Rows(xs) => {
@ -166,8 +166,11 @@ pub fn render(
let mut chunks = layout.split(size).into_iter();
let mut ws = ws.into_iter();
while let (Some(chunk), Some(w)) = (chunks.next(), ws.next()) {
frame.render_stateful_widget(w, chunk, &mut liststate.clone());
if let (Some(chunk), Some(w)) = (chunks.next(), ws.next()) {
frame.render_stateful_widget(w, chunk, liststate);
while let (Some(chunk), Some(w)) = (chunks.next(), ws.next()) {
frame.render_stateful_widget(w, chunk, &mut liststate.clone());
}
}
}
}

View file

@ -163,7 +163,7 @@ async fn run() -> Result<()> {
&queue,
&status,
selected,
&liststate,
&mut liststate,
);
})
.context("Failed to draw to terminal")?,