Skip to content

Commit

Permalink
chore: update to ratatui v0.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Beastwick18 committed Aug 14, 2024
1 parent ab52159 commit f4a5c47
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 49 deletions.
91 changes: 68 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ lto = true
reqwest = { version = "0.12.5", features = ["cookies", "gzip"], default-features = false }
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
urlencoding = "2.1.3"
ratatui = { version = "0.27.0", default-features = false, features = ["crossterm"] }
ratatui = { version = "0.28.0", default-features = false, features = ["crossterm"] }
textwrap = { version = "0.16.1", default-features = false }
crossterm = { version = "0.27.0", default-features = false }
crossterm = { version = "0.28.1", default-features = false }
unicode-width = "0.1.13"
toml = "0.8.14"
directories = "5.0.1"
Expand All @@ -46,7 +46,6 @@ base64 = { version = "0.22.1", default-features = false, features = ["alloc"] }
lexopt = "0.3.0"
ratatui-image = { version = "1.0.1", optional = true , default-features = false }
image = { version = "0.25.1", optional = true, features = ["png"], default-features = false }
color-to-tui = { version = "0.3.0", default-features = false }

[lib]
name = "nyaa"
Expand Down
8 changes: 4 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crossterm::event::{Event, KeyCode, KeyEvent, KeyEventKind};
use indexmap::IndexMap;
use ratatui::{
backend::Backend,
layout::{Constraint, Direction, Layout},
layout::{Constraint, Direction, Layout, Position},
Frame, Terminal,
};
use reqwest::cookie::Jar;
Expand Down Expand Up @@ -431,7 +431,7 @@ impl App {
ctx.deltatime = last_time.map(|l| (now - l).as_secs_f64()).unwrap_or(0.0);
last_time = Some(now);

if self.widgets.notification.update(ctx.deltatime, size) {
if self.widgets.notification.update(ctx.deltatime, (Position::ORIGIN, size).into()) {
break;
}
} else {
Expand Down Expand Up @@ -524,7 +524,7 @@ impl App {
Direction::Vertical,
[Constraint::Length(3), Constraint::Min(1)],
)
.split(f.size());
.split(f.area());

self.widgets.search.draw(f, ctx, layout_vertical[0]);
// Dont draw batch pane if empty
Expand All @@ -543,7 +543,7 @@ impl App {
self.widgets.batch.draw(f, ctx, layout_horizontal[1]);
}
self.widgets.draw_popups(ctx, f);
self.widgets.notification.draw(f, ctx, f.size());
self.widgets.notification.draw(f, ctx, f.area());
}

fn on<B: Backend, const TEST: bool>(
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! widgets {
match ctx.mode {
$(
$(#[$docs])*
$($pmode => self.$pwidget.draw(f, ctx, f.size()),)?
$($pmode => self.$pwidget.draw(f, ctx, f.area()),)?
)+
_ => {}
}
Expand Down
1 change: 1 addition & 0 deletions src/source/nyaa_html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
sync::SearchQuery,
theme::Theme,
util::{
colors::color_to_tui,
conv::{shorten_number, to_bytes},
html::{as_type, attr, inner},
},
Expand Down
1 change: 1 addition & 0 deletions src/source/sukebei_nyaa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
sync::SearchQuery,
theme::Theme,
util::{
colors::color_to_tui,
conv::to_bytes,
html::{attr, inner},
},
Expand Down
1 change: 1 addition & 0 deletions src/source/torrent_galaxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{
sync::SearchQuery,
theme::Theme,
util::{
colors::color_to_tui,
conv::{shorten_number, to_bytes},
html::{as_type, attr, inner},
},
Expand Down
2 changes: 1 addition & 1 deletion src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use indexmap::IndexMap;
use ratatui::{prelude::Color, widgets::BorderType};
use serde::{Deserialize, Deserializer, Serialize, Serializer};

use crate::{app::Context, collection, config, source::SourceTheme};
use crate::{app::Context, collection, config, source::SourceTheme, util::colors::color_to_tui};

pub static THEMES_PATH: &str = "themes";

Expand Down
1 change: 1 addition & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod cmd;
pub mod colors;
pub mod conv;
pub mod html;
pub mod strings;
Expand Down
Loading

0 comments on commit f4a5c47

Please sign in to comment.