From 290039b45c18b78187e905352837ea72e4f52227 Mon Sep 17 00:00:00 2001 From: serg <91432388+hiimsergey@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:31:28 +0200 Subject: [PATCH] make scrolling more efficient --- src/lib.rs | 6 +++--- src/logic.rs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 37ee817..3d465e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ mod util; use cursive::{ event::Key, theme::{BaseColor, Color}, - view::{Nameable, Resizable}, + view::{Nameable, Resizable, ScrollStrategy}, views::{ Button, Dialog, DummyView, EditView, LinearLayout, ListView, OnEventView, Panel, ScrollView, TextView, @@ -68,7 +68,7 @@ Utilizes the \"cursive\" crate for building TUIs. .child( TextView::new( " -v. 0.2.7 - GPLv3 License ", +v. 0.2.9 - GPLv3 License ", ) .style(Color::Dark(BaseColor::Blue)), ), @@ -115,7 +115,7 @@ Code length: {pass_len}" .fixed_width(pass_len as usize + 1), ); - let list = Panel::new(ScrollView::new(ListView::new()).with_name("list")) + let list = Panel::new(ScrollView::new(ListView::new()).scroll_strategy(ScrollStrategy::StickToBottom).with_name("list")) .fixed_height(12) .fixed_width(2 * (pass_len as usize) + 14); let game_sidebar = LinearLayout::vertical() diff --git a/src/logic.rs b/src/logic.rs index 62bd2b1..928eae3 100644 --- a/src/logic.rs +++ b/src/logic.rs @@ -101,7 +101,6 @@ fn print_feedback(s: &mut Cursive, guess: &str, feedback: String) { len_fmt = guess.len() + 4 )), ); - v.scroll_to_bottom(); }); if feedback.chars().all(|c| c == '!') {