diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a569047..f1aa482 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,6 +3,9 @@
+ {
+ "useNewFormat": true
+}
@@ -14,7 +17,6 @@
-
@@ -62,11 +64,11 @@
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
"org.rust.disableDetachedFileInspectionD:/bibliofile/src/html_module.rs": "true",
"org.rust.disableDetachedFileInspectionD:/bibliofile/src/main.rs": "true",
- "settings.editor.selected.configurable": "org.jetbrains.plugins.github.ui.GithubSettingsConfigurable",
+ "settings.editor.selected.configurable": "language.rust",
"vue.rearranger.settings.migration": "true"
}
}]]>
-
+
@@ -101,13 +103,9 @@
-
-
-
-
-
+
@@ -124,6 +122,9 @@
+
+
+ 1687972565061
diff --git a/src/main.rs b/src/main.rs
index 1d73576..c2bf961 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,7 @@ use epub::doc::EpubDoc; //library for navigating epubs
use std::*;
use std::path::Path;
use std::process::exit;
-use tuikit::term::{Term, TermHeight};
+use tuikit::term::{Term};
use tuikit::prelude::*;
//this function will determine if Bibliofile has been opened before. If it has not, it will create a library folder under /opt/bibliofile.
@@ -33,7 +33,7 @@ fn library_exists(){
//initial function. Reads the ebook passed by argument.
//TODO: add visual library to pull up ebooks.
fn main() {
- library_exists();
+ //library_exists();
if env::args().len() == 1 {
println!("you need to enter a book. Closing program.");
}
@@ -51,15 +51,12 @@ fn epub_func(epub_file: &str){
let doc = EpubDoc::new(&epub_file);
assert!(doc.is_ok());
-
let mut doc = doc.unwrap();
+ let term: Term<()> = Term::new().unwrap();
+ let _ = term.print(1, 0, "Use the left and right button to turn the page.\nUp and down scrolls. Press escape or q to quit.");
- let term: Term<()> = Term::with_height(TermHeight::Percent(90)).unwrap();
- let _ = term.clear();
- let _ = term.print(0, 0, "Use the left and right button to turn the page.\nUp and down scrolls. Press escape or q to quit.");
- let _ = term.present();
let mut page_num = 1;
@@ -68,6 +65,7 @@ fn epub_func(epub_file: &str){
//If letter q pressed, closes program.
while let Ok(ev) = term.poll_event() {
+ let (width, height) = term.term_size().unwrap();
match ev {
Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break,
@@ -76,18 +74,13 @@ fn epub_func(epub_file: &str){
_ => {}
}
doc.set_current_page(page_num);
- let attr = Attr{ fg: Color::WHITE, ..Attr::default() };
+
let content = doc.get_current_str();
let str_content = content.unwrap();
let text = html_module::main(str_content.0);
- let _ = term.print(1, 0, &*text);
- //let _ = term.set_cursor(0, 0);
+
+ let _ = term.print(2, 0, &text);
let _ = term.present();
- //let _ = term.clear();
-
}
-}
-
-
-
+}
\ No newline at end of file