diff --git a/Cargo.lock b/Cargo.lock index 2ea2923d..1317bc15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,6 +137,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "blake2b_simd" version = "1.0.0" @@ -338,7 +344,7 @@ dependencies = [ "chacha20poly1305", "clap", "copypasta-ext", - "crossterm 0.26.1", + "crossterm", "data-encoding", "dirs", "getrandom", @@ -347,6 +353,7 @@ dependencies = [ "md-5", "once_cell", "qrcode", + "ratatui", "regex", "rpassword", "rust-argon2", @@ -355,7 +362,6 @@ dependencies = [ "serde_json", "sha-1", "sha2", - "tui", "urlencoding", "zeroize", ] @@ -378,29 +384,13 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - [[package]] name = "crossterm" version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossterm_winapi", "libc", "mio", @@ -601,6 +591,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "indoc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" + [[package]] name = "inout" version = "0.1.3" @@ -758,7 +754,7 @@ version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset", @@ -815,6 +811,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -896,6 +901,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pbkdf2" version = "0.12.1" @@ -972,13 +983,29 @@ dependencies = [ "getrandom", ] +[[package]] +name = "ratatui" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5" +dependencies = [ + "bitflags 2.3.3", + "cassowary", + "crossterm", + "indoc", + "paste", + "time", + "unicode-segmentation", + "unicode-width", +] + [[package]] name = "redox_syscall" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1060,7 +1087,7 @@ version = "0.37.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -1202,7 +1229,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ - "bitflags", + "bitflags 1.3.2", "dlib", "lazy_static", "log", @@ -1279,18 +1306,23 @@ dependencies = [ ] [[package]] -name = "tui" -version = "0.19.0" +name = "time" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ - "bitflags", - "cassowary", - "crossterm 0.25.0", - "unicode-segmentation", - "unicode-width", + "libc", + "num_threads", + "serde", + "time-core", ] +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + [[package]] name = "typenum" version = "1.15.0" @@ -1355,7 +1387,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix", @@ -1394,7 +1426,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client", "wayland-commons", "wayland-scanner", diff --git a/Cargo.toml b/Cargo.toml index db42e10b..12af3b1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,8 +32,6 @@ serde = { version = "1.0.177", features = ["derive"] } dirs = "5.0.1" rpassword = "7.2.0" data-encoding = "2.4.0" -crossterm = "0.26.1" -tui = "0.19.0" copypasta-ext = "0.4.4" zeroize = "1.6.0" clap = { version = "4.3.19", features = ["derive"] } @@ -52,3 +50,5 @@ regex = "1.9.1" once_cell = "1.18.0" base64 = "0.21.2" md-5 = "0.10.5" +ratatui = { version = "0.22.0", features = ["all-widgets"] } +crossterm = "0.26.1" diff --git a/src/interface/app.rs b/src/interface/app.rs index 12a98394..3b35f262 100644 --- a/src/interface/app.rs +++ b/src/interface/app.rs @@ -4,12 +4,12 @@ use crate::interface::enums::Focus; use crate::interface::enums::Page; use crate::interface::enums::Page::{Main, Qrcode}; use crate::otp::otp_element::OTPDatabase; -use tui::backend::Backend; -use tui::layout::Rect; -use tui::layout::{Alignment, Constraint, Direction, Layout}; -use tui::style::{Color, Modifier, Style}; -use tui::terminal::Frame; -use tui::widgets::{Block, Borders, Cell, Clear, Gauge, Paragraph, Row, Table, Wrap}; +use ratatui::backend::Backend; +use ratatui::layout::Rect; +use ratatui::layout::{Alignment, Constraint, Direction, Layout}; +use ratatui::style::{Color, Modifier, Style}; +use ratatui::terminal::Frame; +use ratatui::widgets::{Block, Borders, Cell, Clear, Gauge, Paragraph, Row, Table, Wrap}; use crate::interface::stateful_table::{fill_table, StatefulTable}; use crate::utils::percentage; diff --git a/src/interface/popup.rs b/src/interface/popup.rs index 16180727..f542e345 100644 --- a/src/interface/popup.rs +++ b/src/interface/popup.rs @@ -1,5 +1,5 @@ -use tui::layout::{Constraint, Direction}; -use tui::layout::{Layout, Rect}; +use ratatui::layout::{Constraint, Direction}; +use ratatui::layout::{Layout, Rect}; /// helper function to create a centered rect using up certain percentage of the available rect `r` pub(crate) fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect { diff --git a/src/interface/row.rs b/src/interface/row.rs index fb3cb723..1cb137d2 100644 --- a/src/interface/row.rs +++ b/src/interface/row.rs @@ -1,6 +1,6 @@ -use tui::style::Color::{Black, Yellow}; -use tui::style::Style; -use tui::widgets::Cell; +use ratatui::style::Color::{Black, Yellow}; +use ratatui::style::Style; +use ratatui::widgets::Cell; pub(crate) struct Row { pub(crate) values: Vec, diff --git a/src/interface/stateful_table.rs b/src/interface/stateful_table.rs index 84bb1856..ab31db5e 100644 --- a/src/interface/stateful_table.rs +++ b/src/interface/stateful_table.rs @@ -1,5 +1,5 @@ use crate::interface::row::Row; -use tui::widgets::TableState; +use ratatui::widgets::TableState; use crate::otp::{otp_element::OTPElement, otp_type::OTPType}; diff --git a/src/interface/ui.rs b/src/interface/ui.rs index ca1ec90b..e8148c02 100644 --- a/src/interface/ui.rs +++ b/src/interface/ui.rs @@ -2,8 +2,8 @@ use std::io; use crossterm::event::{DisableMouseCapture, EnableMouseCapture}; use crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen}; -use tui::backend::Backend; -use tui::Terminal; +use ratatui::prelude::Backend; +use ratatui::Terminal; use crate::interface::app::{App, AppResult}; use crate::interface::event::EventHandler; diff --git a/src/main.rs b/src/main.rs index ad57769d..462aff74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,10 +6,10 @@ use interface::event::{Event, EventHandler}; use interface::handler::handle_key_events; use interface::ui::Tui; use otp::otp_element::{OTPDatabase, CURRENT_DATABASE_VERSION}; +use ratatui::prelude::CrosstermBackend; +use ratatui::Terminal; use reading::{get_elements, ReadResult}; use std::{io, vec}; -use tui::backend::CrosstermBackend; -use tui::Terminal; use zeroize::Zeroize; mod args;