mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-01 23:51:46 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22bdb7d92b |
@@ -1,8 +1,6 @@
|
||||
# Unreleased
|
||||
|
||||
- Switched simd base64 crate for one that works on stable (from `vb64` to `base64_simd`)
|
||||
- Allow boolean arguments to function as flags, without a `true` or `false` argument following the flag itself
|
||||
- Fix cropping issues when zooming out too much while using kitty protocol
|
||||
|
||||
# v0.4.3
|
||||
|
||||
|
||||
Generated
+467
-286
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -49,7 +49,7 @@ log = "0.4.27"
|
||||
flexi_logger = "0.31"
|
||||
|
||||
# for tracing with tokio-console
|
||||
console-subscriber = { version = "0.5.0", optional = true }
|
||||
console-subscriber = { version = "0.4.0", optional = true }
|
||||
csscolorparser = { version = "0.7.0" }
|
||||
|
||||
[profile.production]
|
||||
@@ -92,7 +92,7 @@ checked_conversions = "warn"
|
||||
copy_iterator = "warn"
|
||||
default_trait_access = "warn"
|
||||
doc_link_with_quotes = "warn"
|
||||
empty_enums = "warn"
|
||||
empty_enum = "warn"
|
||||
explicit_into_iter_loop = "warn"
|
||||
explicit_iter_loop = "warn"
|
||||
filter_map_next = "warn"
|
||||
|
||||
+9
-4
@@ -83,11 +83,11 @@ async fn inner_main() -> Result<(), WrappedErr> {
|
||||
let flags = xflags::parse_or_exit! {
|
||||
/// Display the pdf with the pages starting at the right hand size and moving left and
|
||||
/// adjust input keys to match
|
||||
optional -r,--r-to-l
|
||||
optional -r,--r-to-l r_to_l: bool
|
||||
/// The maximum number of pages to display together, horizontally, at a time
|
||||
optional -m,--max-wide max_wide: NonZeroUsize
|
||||
/// Fullscreen the pdf (hide document name, page count, etc)
|
||||
optional -f,--fullscreen
|
||||
optional -f,--fullscreen fullscreen: bool
|
||||
/// The number of pages to prerender surrounding the currently-shown page; 0 means no
|
||||
/// limit. By default, there is no limit.
|
||||
optional -p,--prerender prerender: usize
|
||||
@@ -267,7 +267,12 @@ async fn inner_main() -> Result<(), WrappedErr> {
|
||||
|| "Unknown file".into(),
|
||||
|n| n.to_string_lossy().to_string()
|
||||
);
|
||||
let tui = Tui::new(file_name, flags.max_wide, flags.r_to_l, is_kitty);
|
||||
let tui = Tui::new(
|
||||
file_name,
|
||||
flags.max_wide,
|
||||
flags.r_to_l.unwrap_or_default(),
|
||||
is_kitty
|
||||
);
|
||||
|
||||
let backend = CrosstermBackend::new(std::io::stdout());
|
||||
let mut term = Terminal::new(backend).map_err(|e| {
|
||||
@@ -295,7 +300,7 @@ async fn inner_main() -> Result<(), WrappedErr> {
|
||||
})?;
|
||||
}
|
||||
|
||||
let fullscreen = flags.fullscreen;
|
||||
let fullscreen = flags.fullscreen.unwrap_or_default();
|
||||
let main_area = Tui::main_layout(&term.get_frame(), fullscreen);
|
||||
to_renderer
|
||||
.send(RenderNotif::Area(main_area.page_area))
|
||||
|
||||
+13
-18
@@ -205,28 +205,23 @@ impl Tui {
|
||||
|
||||
log::debug!("zoom is now {zoom:#?}");
|
||||
log::debug!("img_area is {img_area:#?}");
|
||||
log::debug!("img dimensions are {cell_w}x{cell_h}");
|
||||
|
||||
let img_width = f32::from(cell_w);
|
||||
let img_height = f32::from(cell_h);
|
||||
|
||||
let img_aspect_ratio = img_width / img_height;
|
||||
|
||||
if zoom.level < 0 {
|
||||
let old_width = img_area.width;
|
||||
img_area.width = img_area
|
||||
.width
|
||||
.saturating_sub((zoom.level * 2).unsigned_abs())
|
||||
.max((f32::from(img_area.height) * img_aspect_ratio) as u16);
|
||||
img_area.x += (old_width - img_area.width) / 2;
|
||||
|
||||
log::debug!("after adjustment, img_area is {img_area:#?}");
|
||||
|
||||
// TODO: Find a way to detect when we've hit the maximum zoom-out and stop
|
||||
// more zooming out
|
||||
img_area = Rect {
|
||||
width: img_area
|
||||
.width
|
||||
.saturating_sub((zoom.level * 2).unsigned_abs())
|
||||
.max(1),
|
||||
x: img_area.x + (zoom.level.unsigned_abs().min(img_area.width / 2)),
|
||||
..img_area
|
||||
}
|
||||
}
|
||||
|
||||
log::debug!("after adjustment, img_area is {img_area:#?}");
|
||||
|
||||
// Ugh I don't like this logic. I wish we could simplify it.
|
||||
let img_width = f32::from(cell_w);
|
||||
let img_height = f32::from(cell_h);
|
||||
let img_area_width = f32::from(img_area.width);
|
||||
let img_area_height = f32::from(img_area.height);
|
||||
let available_to_real_width_ratio = img_area_width / img_width;
|
||||
@@ -792,7 +787,7 @@ impl Tui {
|
||||
}
|
||||
}
|
||||
|
||||
// I want this to always return an option 'cause I just use it to return from `Self::handle_event`
|
||||
// I want this to always return 0 'cause I just use it to return from `Self::handle_event`]
|
||||
#[expect(clippy::unnecessary_wraps)]
|
||||
fn update_zoom(&mut self, f: impl FnOnce(&mut Zoom)) -> Option<InputAction> {
|
||||
if let Some(z) = &mut self.zoom {
|
||||
|
||||
Reference in New Issue
Block a user