mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-02 08:01:47 -04:00
Make tdf run on stable with --no-default-features
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
- Add `--r-to-l` flag to support displaying pdfs that read from right to left
|
- Add `--r-to-l` flag to support displaying pdfs that read from right to left
|
||||||
- Add `--max-wide` flag to restrict amount of pages that can appear on the screen at a time
|
- Add `--max-wide` flag to restrict amount of pages that can appear on the screen at a time
|
||||||
- Small internal changes to accomodate a few more clippy lints
|
- Small internal changes to accomodate a few more clippy lints
|
||||||
|
- Update `ratatui` and `ratatui-image` git dependencies to latest upstream
|
||||||
|
- Move `ratatui-image/vb64` support under `nightly` feature, enabled by default
|
||||||
|
|
||||||
# v0.1.0
|
# v0.1.0
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -26,7 +26,7 @@ cairo-rs = { version = "0.20.0", default-features = false, features = ["png"] }
|
|||||||
ratatui = { git = "https://github.com/itsjunetime/ratatui.git" }
|
ratatui = { git = "https://github.com/itsjunetime/ratatui.git" }
|
||||||
# ratatui = { path = "./ratatui/ratatui" }
|
# ratatui = { path = "./ratatui/ratatui" }
|
||||||
# We're using this to have the vb64 feature (for faster base64 encoding, since that does take up a good bit of time when converting images to the Box<dyn ratatui_image::Protocol>. It also just includes a few more features that I'm waiting on main to upstream
|
# We're using this to have the vb64 feature (for faster base64 encoding, since that does take up a good bit of time when converting images to the Box<dyn ratatui_image::Protocol>. It also just includes a few more features that I'm waiting on main to upstream
|
||||||
ratatui-image = { git = "https://github.com/itsjunetime/ratatui-image.git", branch = "vb64_on_personal", features = ["vb64"], default-features = false }
|
ratatui-image = { git = "https://github.com/itsjunetime/ratatui-image.git", branch = "vb64_on_personal", default-features = false }
|
||||||
# ratatui-image = { path = "./ratatui-image", features = ["vb64"], default-features = false }
|
# ratatui-image = { path = "./ratatui-image", features = ["vb64"], default-features = false }
|
||||||
crossterm = { version = "0.28.1", features = ["event-stream"] }
|
crossterm = { version = "0.28.1", features = ["event-stream"] }
|
||||||
image = { version = "0.25.1", features = ["png", "rayon"], default-features = false }
|
image = { version = "0.25.1", features = ["png", "rayon"], default-features = false }
|
||||||
@@ -46,7 +46,8 @@ inherits = "release"
|
|||||||
lto = "fat"
|
lto = "fat"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["nightly"]
|
||||||
|
nightly = ["ratatui-image/vb64"]
|
||||||
tracing = ["tokio/tracing", "dep:console-subscriber"]
|
tracing = ["tokio/tracing", "dep:console-subscriber"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![feature(if_let_guard)]
|
|
||||||
|
|
||||||
pub mod converter;
|
pub mod converter;
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
pub mod skip;
|
pub mod skip;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![feature(if_let_guard)]
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
io::{stdout, Read, Write},
|
io::{stdout, Read, Write},
|
||||||
num::NonZeroUsize,
|
num::NonZeroUsize,
|
||||||
|
|||||||
+40
-36
@@ -368,54 +368,37 @@ impl Tui {
|
|||||||
match ev {
|
match ev {
|
||||||
Event::Key(key) => {
|
Event::Key(key) => {
|
||||||
match key.code {
|
match key.code {
|
||||||
KeyCode::Char(c)
|
KeyCode::Char(c) => {
|
||||||
if let BottomMessage::Input(InputCommand::Search(ref mut term)) =
|
// TODO: refactor back to `if let` arm guards when those are stabilized
|
||||||
self.bottom_msg =>
|
if let BottomMessage::Input(InputCommand::Search(ref mut term)) = self.bottom_msg {
|
||||||
{
|
|
||||||
term.push(c);
|
term.push(c);
|
||||||
Some(InputAction::Redraw)
|
return Some(InputAction::Redraw);
|
||||||
}
|
}
|
||||||
KeyCode::Backspace
|
|
||||||
if let BottomMessage::Input(InputCommand::Search(ref mut term)) =
|
if let BottomMessage::Input(InputCommand::GoToPage(ref mut page)) = self.bottom_msg {
|
||||||
self.bottom_msg =>
|
return c.to_digit(10).map(|input_num| {
|
||||||
{
|
|
||||||
term.pop();
|
|
||||||
Some(InputAction::Redraw)
|
|
||||||
}
|
|
||||||
KeyCode::Char(c)
|
|
||||||
if let BottomMessage::Input(InputCommand::GoToPage(ref mut page)) =
|
|
||||||
self.bottom_msg =>
|
|
||||||
c.to_digit(10).map(|input_num| {
|
|
||||||
*page = (*page * 10) + input_num as usize;
|
*page = (*page * 10) + input_num as usize;
|
||||||
InputAction::Redraw
|
InputAction::Redraw
|
||||||
}),
|
});
|
||||||
KeyCode::Right | KeyCode::Char('l') =>
|
|
||||||
self.change_page(PageChange::Next, ChangeAmount::Single),
|
|
||||||
KeyCode::Down | KeyCode::Char('j') =>
|
|
||||||
self.change_page(PageChange::Next, ChangeAmount::WholeScreen),
|
|
||||||
KeyCode::Left | KeyCode::Char('h') =>
|
|
||||||
self.change_page(PageChange::Prev, ChangeAmount::Single),
|
|
||||||
KeyCode::Up | KeyCode::Char('k') =>
|
|
||||||
self.change_page(PageChange::Prev, ChangeAmount::WholeScreen),
|
|
||||||
KeyCode::Esc => match self.bottom_msg {
|
|
||||||
BottomMessage::Input(_) => {
|
|
||||||
self.set_bottom_msg(None);
|
|
||||||
Some(InputAction::Redraw)
|
|
||||||
}
|
}
|
||||||
_ => Some(InputAction::QuitApp)
|
|
||||||
},
|
match c {
|
||||||
KeyCode::Char('q') => Some(InputAction::QuitApp),
|
'l' => self.change_page(PageChange::Next, ChangeAmount::Single),
|
||||||
KeyCode::Char('g') => {
|
'j' => self.change_page(PageChange::Next, ChangeAmount::WholeScreen),
|
||||||
|
'h' => self.change_page(PageChange::Prev, ChangeAmount::Single),
|
||||||
|
'k' => self.change_page(PageChange::Prev, ChangeAmount::WholeScreen),
|
||||||
|
'q' => Some(InputAction::QuitApp),
|
||||||
|
'g' => {
|
||||||
self.set_bottom_msg(Some(BottomMessage::Input(InputCommand::GoToPage(0))));
|
self.set_bottom_msg(Some(BottomMessage::Input(InputCommand::GoToPage(0))));
|
||||||
Some(InputAction::Redraw)
|
Some(InputAction::Redraw)
|
||||||
}
|
}
|
||||||
KeyCode::Char('/') => {
|
'/' => {
|
||||||
self.set_bottom_msg(Some(BottomMessage::Input(InputCommand::Search(
|
self.set_bottom_msg(Some(BottomMessage::Input(InputCommand::Search(
|
||||||
String::new()
|
String::new()
|
||||||
))));
|
))));
|
||||||
Some(InputAction::Redraw)
|
Some(InputAction::Redraw)
|
||||||
}
|
}
|
||||||
KeyCode::Char('n') if self.page < self.rendered.len() - 1 => {
|
'n' if self.page < self.rendered.len() - 1 => {
|
||||||
// TODO: If we can't find one, then maybe like block until we've verified
|
// TODO: If we can't find one, then maybe like block until we've verified
|
||||||
// all the pages have been checked?
|
// all the pages have been checked?
|
||||||
let next_page = self.rendered[(self.page + 1)..]
|
let next_page = self.rendered[(self.page + 1)..]
|
||||||
@@ -429,7 +412,7 @@ impl Tui {
|
|||||||
|
|
||||||
jump_to_page(&mut self.page, &mut self.last_render.rect, next_page)
|
jump_to_page(&mut self.page, &mut self.last_render.rect, next_page)
|
||||||
}
|
}
|
||||||
KeyCode::Char('N') if self.page > 0 => {
|
'N' if self.page > 0 => {
|
||||||
let prev_page = self.rendered[..(self.page)]
|
let prev_page = self.rendered[..(self.page)]
|
||||||
.iter()
|
.iter()
|
||||||
.rev()
|
.rev()
|
||||||
@@ -441,7 +424,28 @@ impl Tui {
|
|||||||
});
|
});
|
||||||
|
|
||||||
jump_to_page(&mut self.page, &mut self.last_render.rect, prev_page)
|
jump_to_page(&mut self.page, &mut self.last_render.rect, prev_page)
|
||||||
|
},
|
||||||
|
_ => None
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
KeyCode::Backspace => {
|
||||||
|
if let BottomMessage::Input(InputCommand::Search(ref mut term)) = self.bottom_msg {
|
||||||
|
term.pop();
|
||||||
|
return Some(InputAction::Redraw);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
},
|
||||||
|
KeyCode::Right => self.change_page(PageChange::Next, ChangeAmount::Single),
|
||||||
|
KeyCode::Down => self.change_page(PageChange::Next, ChangeAmount::WholeScreen),
|
||||||
|
KeyCode::Left => self.change_page(PageChange::Prev, ChangeAmount::Single),
|
||||||
|
KeyCode::Up => self.change_page(PageChange::Prev, ChangeAmount::WholeScreen),
|
||||||
|
KeyCode::Esc => match self.bottom_msg {
|
||||||
|
BottomMessage::Input(_) => {
|
||||||
|
self.set_bottom_msg(None);
|
||||||
|
Some(InputAction::Redraw)
|
||||||
|
}
|
||||||
|
_ => Some(InputAction::QuitApp)
|
||||||
|
},
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
let BottomMessage::Input(_) = self.bottom_msg else {
|
let BottomMessage::Input(_) = self.bottom_msg else {
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
Reference in New Issue
Block a user