Skip to content

Commit

Permalink
fix(app): upgrade ratatui to 0.28.1, update related deps, update code…
Browse files Browse the repository at this point in the history
… usages

Signed-off-by: Deep Panchal <deep302001@gmail.com>
  • Loading branch information
deepanchal committed Sep 28, 2024
1 parent b2898f1 commit 360d481
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 251 deletions.
454 changes: 218 additions & 236 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ clap = { version = "4.4.5", features = [
] }
color-eyre = "0.6.2"
config = "0.14.0"
crossterm = { version = "0.27.0", features = ["serde", "event-stream"] }
crossterm = { version = "0.28.1", features = ["serde", "event-stream"] }
derive_deref = "1.1.1"
directories = "5.0.1"
futures = "0.3.28"
Expand All @@ -35,7 +35,7 @@ lazy_static = "1.4.0"
libc = "0.2.148"
log = "0.4.20"
pretty_assertions = "1.4.0"
ratatui = { version = "0.27.0", features = ["serde", "macros"] }
ratatui = { version = "0.28.1", features = ["serde", "macros"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
signal-hook = "0.3.17"
Expand All @@ -46,7 +46,7 @@ tokio-util = "0.7.9"
tracing = "0.1.37"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "serde"] }
tui-input = "0.9.0"
tui-input = "0.10.1"

[build-dependencies]
vergen-git2 = { version = "1.0.0", features = ["build"] }
Expand Down
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl App {
Constraint::Max(1),
])
.horizontal_margin(1)
.split(f.size());
.split(f.area());

let header_chunk = vertical_layout[0];
let main_chunk = vertical_layout[1];
Expand Down Expand Up @@ -384,7 +384,7 @@ impl App {
Constraint::Length(10),
Constraint::Min(1),
])
.split(f.size());
.split(f.area());

let popup_layout = Layout::horizontal(vec![
Constraint::Min(3),
Expand Down
4 changes: 2 additions & 2 deletions src/components.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use color_eyre::eyre::Result;
use crossterm::event::{KeyEvent, MouseEvent};
use ratatui::layout::Rect;
use ratatui::layout::{Rect, Size};
use tokio::sync::mpsc::UnboundedSender;

use crate::{
Expand Down Expand Up @@ -56,7 +56,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<()>` - An Ok result or an error.
fn init(&mut self, area: Rect) -> Result<()> {
fn init(&mut self, area: Size) -> Result<()> {
Ok(())
}
/// Handle incoming events and produce actions if necessary.
Expand Down
2 changes: 1 addition & 1 deletion src/components/books.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BooksPane {
}

impl Component for BooksPane {
fn init(&mut self, area: Rect) -> Result<()> {
fn init(&mut self, area: Size) -> Result<()> {
self.send_action(Action::LoadBooks)?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl ContentPane {
}

impl Component for ContentPane {
fn init(&mut self, area: Rect) -> Result<()> {
fn init(&mut self, area: Size) -> Result<()> {
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl PagesPane {
}

impl Component for PagesPane {
fn init(&mut self, area: Rect) -> Result<()> {
fn init(&mut self, area: Size) -> Result<()> {
Ok(())
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Popup {
}

impl Component for Popup {
fn init(&mut self, area: Rect) -> Result<()> {
fn init(&mut self, area: Size) -> Result<()> {
Ok(())
}

Expand Down Expand Up @@ -204,10 +204,10 @@ impl Component for Popup {
}
InputMode::Insert => {
// Make the cursor visible and put it at the specified coordinates after rendering
f.set_cursor(
chunks[1].x + ((self.input.visual_cursor()).max(scroll) - scroll) as u16 + 1,
chunks[1].y + 1,
);
f.set_cursor_position(Position {
x: chunks[1].x + ((self.input.visual_cursor()).max(scroll) - scroll) as u16 + 1,
y: chunks[1].y + 1,
});
}
}

Expand Down

0 comments on commit 360d481

Please sign in to comment.