From 25e6644f30185a1ac70f561fa3789892353db39a Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 1 Nov 2020 11:54:18 -0500 Subject: [PATCH] scrolling up now try to only move the selection --- src/layout.rs | 9 ++++++--- src/main.rs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/layout.rs b/src/layout.rs index 7c38deb..6b31fff 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -19,7 +19,7 @@ pub fn render( queue: &Vec, 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()); + } } } } diff --git a/src/main.rs b/src/main.rs index 69cc7f3..cb5db33 100644 --- a/src/main.rs +++ b/src/main.rs @@ -163,7 +163,7 @@ async fn run() -> Result<()> { &queue, &status, selected, - &liststate, + &mut liststate, ); }) .context("Failed to draw to terminal")?,