diff --git a/benches/utils.rs b/benches/utils.rs index 3b7443d..c5ab76b 100644 --- a/benches/utils.rs +++ b/benches/utils.rs @@ -65,7 +65,6 @@ pub fn start_rendering_loop( Sender ) { let pathbuf = path.as_ref().canonicalize().unwrap(); - let str_path = pathbuf.into_os_string().to_string_lossy().to_string(); let (to_render_tx, from_main_rx) = unbounded(); let (to_main_tx, from_render_rx) = unbounded(); @@ -91,7 +90,7 @@ pub fn start_rendering_loop( let cell_width_px = size.width / size.columns; std::thread::spawn(move || { start_rendering( - &str_path, + &pathbuf, to_main_tx, from_main_rx, cell_height_px, diff --git a/src/main.rs b/src/main.rs index 8804610..24bf7b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -209,10 +209,6 @@ async fn inner_main() -> Result<(), WrappedErr> { ) .map_err(|e| WrappedErr(format!("Can't watch the provided file: {e}").into()))?; - // TODO: Handle non-utf8 file names? Maybe by constructing a CString and passing that in to the - // mupdf stuff instead of a rust string? - let file_path = path.clone().into_os_string().to_string_lossy().to_string(); - let mut window_size = window_size().map_err(|e| { WrappedErr(format!("Can't get your current terminal window size: {e}").into()) })?; @@ -266,6 +262,7 @@ async fn inner_main() -> Result<(), WrappedErr> { .and_then(NonZeroUsize::new) .map_or(PrerenderLimit::All, PrerenderLimit::Limited); + let file_path = path.clone(); std::thread::spawn(move || { renderer::start_rendering( &file_path, diff --git a/src/renderer.rs b/src/renderer.rs index 0a32b7a..534d17e 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -1,4 +1,4 @@ -use std::{collections::VecDeque, num::NonZeroUsize, thread::sleep, time::Duration}; +use std::{collections::VecDeque, num::NonZeroUsize, path::Path, thread::sleep, time::Duration}; use flume::{Receiver, SendError, Sender, TryRecvError}; use mupdf::{ @@ -80,7 +80,7 @@ pub fn fill_default(vec: &mut Vec, size: usize) { // probably be more performant if accessed by-value instead of through a reference. Probably. #[expect(clippy::needless_pass_by_value, clippy::too_many_arguments)] pub fn start_rendering( - path: &str, + path: &Path, sender: Sender>, receiver: Receiver, col_h: u16, diff --git a/src/tui.rs b/src/tui.rs index 7a76324..39dc502 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -346,7 +346,6 @@ impl Tui { }]) } - // TODO: Make a way to fill the width of the screen with one page and scroll down to view it #[must_use] pub fn render<'s>( &'s mut self,