mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-01 23:51:46 -04:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a03294557 | |||
| 7c2c6484a6 | |||
| e65472e571 | |||
| 4fd2237b69 | |||
| 69fd8ec7e8 |
@@ -1,5 +1,14 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
# v0.4.2
|
||||||
|
|
||||||
|
- Add `--version` flag
|
||||||
|
- Fix shms not working on macos ([#93](https://github.com/itsjunetime/tdf/pull/93))
|
||||||
|
|
||||||
|
# v0.4.1
|
||||||
|
|
||||||
|
- Add instructions for using new zoom/pan features to help page
|
||||||
|
|
||||||
# v0.4.0
|
# v0.4.0
|
||||||
|
|
||||||
- Update to new `kittage` backend for kitty-protocol-supporting terminals (fixes many issues and improves performance significantly, see [the PR](https://github.com/itsjunetime/tdf/pull/74))
|
- Update to new `kittage` backend for kitty-protocol-supporting terminals (fixes many issues and improves performance significantly, see [the PR](https://github.com/itsjunetime/tdf/pull/74))
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tdf-viewer"
|
name = "tdf-viewer"
|
||||||
version = "0.3.0"
|
version = "0.4.2"
|
||||||
authors = ["June Welker <junewelker@gmail.com>"]
|
authors = ["June Welker <junewelker@gmail.com>"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A terminal viewer for PDFs"
|
description = "A terminal viewer for PDFs"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ If it turns out that you're missing one of these, it will fail to compile and te
|
|||||||
|
|
||||||
1. Get the rust toolchain from [rustup.rs](https://rustup.rs)
|
1. Get the rust toolchain from [rustup.rs](https://rustup.rs)
|
||||||
2. Clone the repo and `cd` into it
|
2. Clone the repo and `cd` into it
|
||||||
3. Run `cargo build --release`
|
3. Run `cargo +nightly build --release`
|
||||||
|
|
||||||
The binary should then be found at `./target/release/tdf`.
|
The binary should then be found at `./target/release/tdf`.
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -139,14 +139,13 @@ pub async fn run_conversion_loop(
|
|||||||
let rn = SystemTime::now()
|
let rn = SystemTime::now()
|
||||||
.duration_since(UNIX_EPOCH)
|
.duration_since(UNIX_EPOCH)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.as_nanos();
|
.as_millis() % 1_000_000;
|
||||||
|
|
||||||
let mut img = if shms_work {
|
let mut img = if shms_work {
|
||||||
kittage::image::Image::shm_from(
|
kittage::image::Image::shm_from(dyn_img, &format!("tdf_{pid}_{rn}_{page_num}"))
|
||||||
dyn_img,
|
.map_err(|e| {
|
||||||
&format!("__tdf_kittage_{pid}_page_{rn}_{page_num}")
|
RenderError::Converting(format!("Couldn't write to shm: {e}"))
|
||||||
)
|
})?
|
||||||
.map_err(|e| RenderError::Converting(format!("Couldn't write to shm: {e}")))?
|
|
||||||
} else {
|
} else {
|
||||||
kittage::image::Image::from(dyn_img)
|
kittage::image::Image::from(dyn_img)
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-2
@@ -78,8 +78,7 @@ pub async fn run_action<'image, 'data, 'es>(
|
|||||||
pub async fn do_shms_work(ev_stream: &mut EventStream) -> bool {
|
pub async fn do_shms_work(ev_stream: &mut EventStream) -> bool {
|
||||||
let img = DynamicImage::new_rgb8(1, 1);
|
let img = DynamicImage::new_rgb8(1, 1);
|
||||||
let pid = std::process::id();
|
let pid = std::process::id();
|
||||||
let Ok(mut k_img) = kittage::image::Image::shm_from(img, &format!("__tdf_kittage_test_{pid}"))
|
let Ok(mut k_img) = kittage::image::Image::shm_from(img, &format!("tdf_test_{pid}")) else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+15
-3
@@ -74,12 +74,24 @@ async fn main() -> Result<(), WrappedErr> {
|
|||||||
optional -w,--white-color white: String
|
optional -w,--white-color white: String
|
||||||
/// Custom black color, specified in css format (e.g "000000" or "rgb(0, 0, 0)")
|
/// Custom black color, specified in css format (e.g "000000" or "rgb(0, 0, 0)")
|
||||||
optional -b,--black-color black: String
|
optional -b,--black-color black: String
|
||||||
|
/// Print the version and exit
|
||||||
|
optional --version
|
||||||
/// PDF file to read
|
/// PDF file to read
|
||||||
required file: PathBuf
|
optional file: PathBuf
|
||||||
};
|
};
|
||||||
|
|
||||||
let path = flags
|
if flags.version {
|
||||||
.file
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(file) = flags.file else {
|
||||||
|
return Err(WrappedErr(
|
||||||
|
"Please specify the file to open, e.g. `tdf ./my_example_pdf.pdf`".into()
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
let path = file
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.map_err(|e| WrappedErr(format!("Cannot canonicalize provided file: {e}").into()))?;
|
.map_err(|e| WrappedErr(format!("Cannot canonicalize provided file: {e}").into()))?;
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -18,8 +18,8 @@ use ratatui::{
|
|||||||
layout::{Constraint, Flex, Layout, Position, Rect},
|
layout::{Constraint, Flex, Layout, Position, Rect},
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
symbols::border,
|
symbols::border,
|
||||||
text::{Span, Text},
|
text::Span,
|
||||||
widgets::{Block, Borders, Clear, Padding}
|
widgets::{Block, Borders, Clear, Padding, Paragraph, Wrap}
|
||||||
};
|
};
|
||||||
use ratatui_image::{FontSize, Image};
|
use ratatui_image::{FontSize, Image};
|
||||||
|
|
||||||
@@ -830,7 +830,7 @@ impl Tui {
|
|||||||
.border_set(border::ROUNDED)
|
.border_set(border::ROUNDED)
|
||||||
.border_style(Color::Blue);
|
.border_style(Color::Blue);
|
||||||
|
|
||||||
let help_span = Text::raw(HELP_PAGE);
|
let help_span = Paragraph::new(HELP_PAGE).wrap(Wrap { trim: false });
|
||||||
|
|
||||||
let max_w: u16 = HELP_PAGE
|
let max_w: u16 = HELP_PAGE
|
||||||
.lines()
|
.lines()
|
||||||
@@ -878,6 +878,12 @@ i:
|
|||||||
Invert colors
|
Invert colors
|
||||||
f:
|
f:
|
||||||
Remove borders/fullscreen
|
Remove borders/fullscreen
|
||||||
|
z (when using kitty protocol):
|
||||||
|
Toggle between fill-screen and fit-screen
|
||||||
|
o/O (when on fill-screen):
|
||||||
|
zoom in and out, respectively
|
||||||
|
H, J, K, L (when zoomed in):
|
||||||
|
pan direction around page
|
||||||
?:
|
?:
|
||||||
Show this page
|
Show this page
|
||||||
ctrl+z:
|
ctrl+z:
|
||||||
|
|||||||
Reference in New Issue
Block a user