diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f1aa482..26e3495 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -15,7 +15,7 @@
-
+
@@ -124,7 +124,7 @@
-
+
1687972565061
@@ -147,7 +147,14 @@
1687974796970
-
+
+ 1693686100048
+
+
+
+ 1693686100048
+
+
@@ -179,7 +186,8 @@
-
+
+
diff --git a/src/main.rs b/src/main.rs
index c2bf961..e305095 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -73,14 +73,29 @@ fn epub_func(epub_file: &str){
Event::Key(Key::Left) => page_num = page_num - 1,
_ => {}
}
- doc.set_current_page(page_num);
+ //This is a really hacky way of doing this.
+ //TODO: Remember to make a more elegant way of handling stack underflow.
+ if(page_num <= 0){
+ doc.set_current_page(1);
+ page_num = 1;
+ let content = doc.get_current_str();
+ let str_content = content.unwrap();
+ let text = html_module::main(str_content.0);
+ let _ = term.set_cursor(1, 1);
- let content = doc.get_current_str();
- let str_content = content.unwrap();
- let text = html_module::main(str_content.0);
+ let _ = term.print(2, 2, &text);
+ let _ = term.present();
+ }
+ else {
+ doc.set_current_page(page_num);
- let _ = term.print(2, 0, &text);
- let _ = term.present();
+ let content = doc.get_current_str();
+ let str_content = content.unwrap();
+ let text = html_module::main(str_content.0);
+ let _ = term.set_cursor(1, 1);
+ let _ = term.print(2, 2, &text);
+ let _ = term.present();
+ }
}
}
\ No newline at end of file