Make searching work much better and actually make the 'n' input skip to the next page with available results

This commit is contained in:
itsjunetime
2024-05-26 01:42:49 -06:00
parent 097c2918e5
commit 698cdf924a
7 changed files with 202 additions and 139 deletions
+4 -6
View File
@@ -63,6 +63,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let backend = CrosstermBackend::new(std::io::stdout());
let mut term = Terminal::new(backend)?;
term.skip_diff(true);
// poppler has some annoying logging (e.g. if you request a page index out-of-bounds of a
// document's pages, then it will return `None`, but still log to stderr with CRITICAL level),
@@ -117,17 +118,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(RenderInfo::NumPages(num)) => {
tui.set_n_pages(num);
converter.set_n_pages(num);
true
},
Ok(RenderInfo::Page(info)) => {
tui.got_num_results_on_page(info.page, info.search_results);
converter.add_img(info);
false
},
Err(e) => {
tui.show_error(e);
true
}
Err(e) => tui.show_error(e),
}
true
}
};