mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-02 08:01:47 -04:00
fix: fmt
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
io::Cursor,
|
||||
num::{NonZeroUsize, NonZeroU32},
|
||||
num::{NonZeroU32, NonZeroUsize},
|
||||
time::{SystemTime, UNIX_EPOCH}
|
||||
};
|
||||
|
||||
|
||||
+6
-3
@@ -128,8 +128,11 @@ pub enum DisplayErrSource<'es> {
|
||||
impl Display for DisplayErrSource<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::KittageReturnedNoId => write!(f, "Kittage returned no ID when we asked it to display an image. This is a bug in kittage, please report it."),
|
||||
Self::Transmission(t) => write!(f, "Error with talking to the terminal: {t}"),
|
||||
Self::KittageReturnedNoId => write!(
|
||||
f,
|
||||
"Kittage returned no ID when we asked it to display an image. This is a bug in kittage, please report it."
|
||||
),
|
||||
Self::Transmission(t) => write!(f, "Error with talking to the terminal: {t}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,7 +213,7 @@ pub async fn display_kitty_images<'es>(
|
||||
Ok(Some(img_id)) => {
|
||||
*img = MaybeTransferred::Transferred(img_id);
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
Ok(None) => Err((page_num, DisplayErrSource::KittageReturnedNoId)),
|
||||
Err(e) => Err((page_num, DisplayErrSource::Transmission(e)))
|
||||
}
|
||||
|
||||
+12
-3
@@ -38,7 +38,9 @@ use ratatui_image::{
|
||||
use tdf::{
|
||||
PrerenderLimit,
|
||||
converter::{ConvertedPage, ConverterMsg, run_conversion_loop},
|
||||
kitty::{DisplayErr, DisplayErrSource, KittyDisplay, display_kitty_images, do_shms_work, run_action},
|
||||
kitty::{
|
||||
DisplayErr, DisplayErrSource, KittyDisplay, display_kitty_images, do_shms_work, run_action
|
||||
},
|
||||
renderer::{self, MUPDF_BLACK, MUPDF_WHITE, RenderError, RenderInfo, RenderNotif},
|
||||
tui::{BottomMessage, InputAction, MessageSetting, Tui}
|
||||
};
|
||||
@@ -462,7 +464,12 @@ async fn enter_redraw_loop(
|
||||
|
||||
let maybe_err = display_kitty_images(to_display, &mut ev_stream).await;
|
||||
|
||||
if let Err(DisplayErr { failed_pages, user_facing_err, source }) = maybe_err {
|
||||
if let Err(DisplayErr {
|
||||
failed_pages,
|
||||
user_facing_err,
|
||||
source
|
||||
}) = maybe_err
|
||||
{
|
||||
match source {
|
||||
// This is the error that kitty & ghostty provide us when they delete an
|
||||
// image due to memory constraints, so if we get it, we just fix it by
|
||||
@@ -471,7 +478,9 @@ async fn enter_redraw_loop(
|
||||
// [TODO] maybe when we detect that an image was deleted, we probe the
|
||||
// terminal for the pages around it to see if they were deleted too and if
|
||||
// they were, we re-render them? idk
|
||||
DisplayErrSource::Transmission(TransmitError::Terminal(TerminalError::NoEntity(_))) => (),
|
||||
DisplayErrSource::Transmission(TransmitError::Terminal(
|
||||
TerminalError::NoEntity(_)
|
||||
)) => (),
|
||||
_ => tui.set_msg(MessageSetting::Some(BottomMessage::Error(format!(
|
||||
"{user_facing_err}: {source}"
|
||||
))))
|
||||
|
||||
Reference in New Issue
Block a user