Fixed stack underflow bug. Must find more elegant solution later.
This commit is contained in:
parent
0c231d8fed
commit
84f86e1d77
@ -15,7 +15,7 @@
|
|||||||
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
|
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="81820af5-b0ad-4ac7-a939-e3db68fc7214" name="Changes" comment="- Can now format HTML - No longer returns to main.rs. Main function in html_module.rs now reads to console locally.">
|
<list default="true" id="81820af5-b0ad-4ac7-a939-e3db68fc7214" name="Changes" comment=" - Full Terminal Size now used - Still working on getting newlines working">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@ -124,7 +124,7 @@
|
|||||||
<workItem from="1689861266305" duration="5017000" />
|
<workItem from="1689861266305" duration="5017000" />
|
||||||
<workItem from="1693679525485" duration="40000" />
|
<workItem from="1693679525485" duration="40000" />
|
||||||
<workItem from="1693679597473" duration="599000" />
|
<workItem from="1693679597473" duration="599000" />
|
||||||
<workItem from="1693680405017" duration="5602000" />
|
<workItem from="1693680405017" duration="6526000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Commit to scraper_framework branch - changing framework from Soup to Scraper - removed ncurses library. Will use different library instead.">
|
<task id="LOCAL-00001" summary="Commit to scraper_framework branch - changing framework from Soup to Scraper - removed ncurses library. Will use different library instead.">
|
||||||
<created>1687972565061</created>
|
<created>1687972565061</created>
|
||||||
@ -147,7 +147,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1687974796970</updated>
|
<updated>1687974796970</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="4" />
|
<task id="LOCAL-00004" summary=" - Full Terminal Size now used - Still working on getting newlines working">
|
||||||
|
<created>1693686100048</created>
|
||||||
|
<option name="number" value="00004" />
|
||||||
|
<option name="presentableId" value="LOCAL-00004" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1693686100048</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="5" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@ -179,7 +186,8 @@
|
|||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="Commit to scraper_framework branch - changing framework from Soup to Scraper - removed ncurses library. Will use different library instead." />
|
<MESSAGE value="Commit to scraper_framework branch - changing framework from Soup to Scraper - removed ncurses library. Will use different library instead." />
|
||||||
<MESSAGE value="- Can now format HTML - No longer returns to main.rs. Main function in html_module.rs now reads to console locally." />
|
<MESSAGE value="- Can now format HTML - No longer returns to main.rs. Main function in html_module.rs now reads to console locally." />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="- Can now format HTML - No longer returns to main.rs. Main function in html_module.rs now reads to console locally." />
|
<MESSAGE value=" - Full Terminal Size now used - Still working on getting newlines working" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=" - Full Terminal Size now used - Still working on getting newlines working" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
27
src/main.rs
27
src/main.rs
@ -73,14 +73,29 @@ fn epub_func(epub_file: &str){
|
|||||||
Event::Key(Key::Left) => page_num = page_num - 1,
|
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 _ = term.print(2, 2, &text);
|
||||||
let str_content = content.unwrap();
|
let _ = term.present();
|
||||||
let text = html_module::main(str_content.0);
|
}
|
||||||
|
else {
|
||||||
|
doc.set_current_page(page_num);
|
||||||
|
|
||||||
let _ = term.print(2, 0, &text);
|
let content = doc.get_current_str();
|
||||||
let _ = term.present();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user