From b23a9b1163b8b738363e1ba5df7be42d0ecbe60e Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Wed, 27 Jun 2018 17:03:51 +0530 Subject: Remove stack view, fix lag with long articles --- src/main.rs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index a3cc713..ad62b77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ extern crate cursive; use cursive::Cursive; use cursive::align::HAlign; use cursive::traits::*; -use cursive::views::{TextView, Dialog, EditView, SelectView, LinearLayout, DummyView}; +use cursive::views::{ TextView, Dialog, EditView, SelectView, LinearLayout, DummyView }; pub mod content; use content::*; @@ -13,7 +13,6 @@ use content::*; fn main() { // Initial setup let mut main = Cursive::default(); - let mut articles_vec = vec![]; main.add_global_callback('q', |s| s.quit()); main.add_global_callback('s', |s| search(s)); @@ -72,19 +71,11 @@ fn on_submit(s: &mut Cursive, name: &String) { Err(e) => pop_error(s, handler(e)) }; - let article_stack = LinearLayout::horizontal() - .child(TextView::new("Stack")) - .child(DummyView.fixed_height(1)); - - s.add_layer(Dialog::around( - LinearLayout::horizontal() - .child( - LinearLayout::vertical() - .child(TextView::new(heading).h_align(HAlign::Center)) - .child(DummyView.fixed_height(1)) - .child(TextView::new(extract)) - ) - .child(article_stack) - ) - ); + s.add_layer( + Dialog::around(TextView::new(extract)) + .title(heading) + .padding_right(5) + .padding_left(5) + .max_width(80) + ); } -- cgit v1.2.3