From 68a862cb5a4b59398af03768b97586eb51b4a8f1 Mon Sep 17 00:00:00 2001 From: Daniel Redd Jones Date: Mon, 24 Jul 2023 18:40:33 -0500 Subject: [PATCH] - Added q as quit button --- src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index a86cbc2..2a54a3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,10 @@ /* Program: Bibliofile -Language: Rustc 1.70.0 +Language: Rustc 1.71.0 ide: CLion Operating system: Fedora 38/WSL Purpose: TUI-based ereader and library manager for Linux terminal environments. -Last edited: 7/20/23 +Last edited: 7/24/23 */ //this is a test change to see if gitea is accepting pushes. @@ -51,12 +51,18 @@ fn epub_func(epub_file: &str){ - /* - let mut next_or_last = String::new(); + let mut page_num = 1; let is_reading = true; + //If letter q pressed, closes program. + while let Ok(ev) = term.poll_event() { + let _ = term.clear(); + match ev { + Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break, + _ => {} + } - while is_reading == true { + /* while is_reading == true { doc.set_current_page(page_num); @@ -65,6 +71,7 @@ fn epub_func(epub_file: &str){ let text = html_module::main(str_content.0); }*/ + } }