Use new mupdf search API

This commit is contained in:
itsjunetime
2025-03-06 10:30:05 -07:00
parent 6462c09030
commit ef8ace4f35
6 changed files with 63 additions and 44 deletions
+5 -1
View File
@@ -129,7 +129,7 @@ pub fn start_all_rendering(path: impl AsRef<Path>) -> RenderState {
}
}
pub async fn render_doc(path: impl AsRef<Path>) {
pub async fn render_doc(path: impl AsRef<Path>, search_term: Option<&str>) {
let RenderState {
mut from_render_rx,
mut from_converter_rx,
@@ -138,6 +138,10 @@ pub async fn render_doc(path: impl AsRef<Path>) {
to_render_tx
} = start_all_rendering(path);
if let Some(term) = search_term {
to_render_tx.send(RenderNotif::Search(term.to_owned())).unwrap();
}
while pages.is_empty() || pages.iter().any(Option::is_none) {
tokio::select! {
Some(renderer_msg) = from_render_rx.next() => {