Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update to ratatui v0.28 #172

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ updates:
commit-message:
prefix: "build(cargo):"
ignore:
- dependency-name: crossterm
update-types: ["version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: rustls*
update-types: ["version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "*"
Expand Down
82 changes: 31 additions & 51 deletions Cargo.lock

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

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ url = "2"
anyhow = "1"
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
clap = { version = "4", features = ["deprecated", "derive", "env", "wrap_help"] }
crossterm = "0.27"
ego-tree = "0.6"
rand = "0.8"
ratatui = "0.26"
ratatui-binary-data-widget = { git = "https://github.com/EdJoPaTo/ratatui-binary-data-widget", branch = "main" }
ratatui = "0.28"
ratatui-binary-data-widget = { git = "https://github.com/EdJoPaTo/ratatui-binary-data-widget", branch = "ratatui-v0.28" }
rmpv = { version = "1", features = ["with-serde"] }
rumqttc = { version = "0.24", features = ["websocket"] }
rustls = "0.22"
Expand All @@ -44,8 +43,7 @@ rustls-pemfile = "2"
rustls-pki-types = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tui-tree-widget = "0.20"
unicode-width = "=0.1.12" # remove version pinning when https://github.com/ratatui-org/ratatui/pull/1226 is released
tui-tree-widget = "0.22"
url = "2"

# https://crates.io/crates/cargo-deb
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/clean_retained.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn draw_popup(frame: &mut Frame, topic: &str) {
Line::raw("Confirm with Enter, abort with Esc"),
];
let text = Text::from(text);
let area = popup_area(frame.size(), text.width());
let area = popup_area(frame.area(), text.width());
let paragraph = Paragraph::new(text)
.block(block)
.alignment(Alignment::Center);
Expand Down
4 changes: 2 additions & 2 deletions src/interactive/footer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ratatui::layout::Rect;
use ratatui::layout::{Position, Rect};
use ratatui::style::{Color, Modifier, Style};
use ratatui::text::{Line, Span};
use ratatui::Frame;
Expand Down Expand Up @@ -95,7 +95,7 @@ impl Footer {
#[allow(clippy::cast_possible_truncation)]
if matches!(app.focus, ElementInFocus::TopicSearch) {
let x = area.left().saturating_add(keys.width() as u16);
frame.set_cursor(x, area.y);
frame.set_cursor_position(Position { x, y: area.y });
}

// Show version / broker when enough space
Expand Down
8 changes: 4 additions & 4 deletions src/interactive/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::time::{Duration, Instant};

use crossterm::event::{
use ratatui::backend::{Backend, CrosstermBackend};
use ratatui::crossterm::event::{
Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind,
};
use ratatui::backend::{Backend, CrosstermBackend};
use ratatui::layout::{Alignment, Position, Rect};
use ratatui::text::Span;
use ratatui::widgets::Paragraph;
use ratatui::{Frame, Terminal};
use ratatui::{crossterm, Frame, Terminal};
use rumqttc::{Client, Connection};

use self::ui::ElementInFocus;
Expand Down Expand Up @@ -618,7 +618,7 @@ impl App {

let connection_error = self.mqtt_thread.has_connection_err();

let area = frame.size();
let area = frame.area();
let Rect { width, height, .. } = area;
debug_assert_eq!(area.x, 0, "area should fill the whole space");
debug_assert_eq!(area.y, 0, "area should fill the whole space");
Expand Down