fn show_text_file(&mut self, content: String) {
        let textwrap = SETTINGS.read().unwrap().get_str("textwrap").unwrap();
        let textwrap_int = textwrap.parse::<usize>().unwrap();
        let mut viewport_width = self.get_viewport_width() - 2;
        viewport_width = std::cmp::min(textwrap_int, viewport_width);
        info!("Viewport-width = {}", viewport_width);
        let mut app = self.app.write().unwrap();
        app.call_on_name("main", |v: &mut ui::layout::Layout| {
            v.set_view("text");
        });
        app.call_on_name("text", |v: &mut SelectView| {
            v.clear();
            let lines = content.lines();
            for l in lines {
                let line = l.to_string();
                if line.len() > viewport_width {
                    let iter = wrap_iter(&line, viewport_width);
                    info!("Wrapping text");
                    for str in iter {
                        v.add_item_str(format!("  {}", str));
                    }
                } else {
                    v.add_item_str(format!("  {}", line));
                }
            }
            // TODO: on_submit-handler to open URLs in text
        });
    }
/// Renders a text file in a cursive::TextView
Renders a text file in a cursive::TextView
Renders a text file in a cursive :: TextView
fn show_text_file(&mut self, content: String) {
        let textwrap = SETTINGS.read().unwrap().get_str("textwrap").unwrap();
        let textwrap_int = textwrap.parse::<usize>().unwrap();
        let mut viewport_width = self.get_viewport_width() - 2;
        viewport_width = std::cmp::min(textwrap_int, viewport_width);
        info!("Viewport-width = {}", viewport_width);
        let mut app = self.app.write().unwrap();
        app.call_on_name("main", |v: &mut ui::layout::Layout| {
            v.set_view("text");
        });
        app.call_on_name("text", |v: &mut SelectView| {
            v.clear();
            let lines = content.lines();
            for l in lines {
                let line = l.to_string();
                if line.len() > viewport_width {
                    let iter = wrap_iter(&line, viewport_width);
                    info!("Wrapping text");
                    for str in iter {
                        v.add_item_str(format!("  {}", str));
                    }
                } else {
                    v.add_item_str(format!("  {}", line));
                }
            }
            // TODO: on_submit-handler to open URLs in text
        });
    }
fn show_text_file ( & mut self , content : String ) { let textwrap = SETTINGS . read ( ) . unwrap ( ) . get_str ( " " ) . unwrap ( ) ; let textwrap_int = textwrap . parse :: < usize > ( ) . unwrap ( ) ; let mut viewport_width = self . get_viewport_width ( ) - 2 ; viewport_width = std :: cmp :: min ( textwrap_int , viewport_width ) ; info ! ( " " viewport_width ) ; let mut app = self . app . write ( ) . unwrap ( ) ; app . call_on_name ( " " , | v : & mut ui :: layout :: Layout | { v . set_view ( " " ) ; } ) ; app . call_on_name ( " " , | v : & mut SelectView | { v . clear ( ) ; let lines = content . lines ( ) ; for l in lines { let line = l . to_string ( ) ; if line . len ( ) > viewport_width { let iter = wrap_iter ( & line , viewport_width ) ; info ! ( " " ) ; for str in iter { v . add_item_str ( format ! ( " " str ) ) ; } } else { v . add_item_str ( format ! ( " " line ) ) ; } } // TODO: on_submit-handler to open URLs in text } ) ; }
Renders a text file in a cursive::TextView
Renders a text file in a cursive :: TextView
&mut self
content
String
&mut self
content
String