From ae44577979db3660db1ca3f8f7c468e3d1fe2dbf Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Mon, 28 Aug 2023 23:24:08 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20Bump=20to=20ratatui=200.23.0=20?= =?UTF-8?q?=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 82 ++++++++++++++++++++++++++------------------- Cargo.toml | 10 +++--- src/app.rs | 14 ++++---- src/calendar.rs | 2 +- src/completion.rs | 4 +-- src/config.rs | 8 ++--- src/help.rs | 2 +- src/main.rs | 2 +- src/pane/context.rs | 2 +- src/pane/project.rs | 2 +- src/scrollbar.rs | 2 +- src/table.rs | 18 +++++----- src/ui.rs | 2 +- 13 files changed, 82 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 767d9f30..0d0e3bdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" dependencies = [ "clap_builder", "clap_derive", @@ -205,9 +205,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" dependencies = [ "anstream", "anstyle", @@ -277,22 +277,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" -[[package]] -name = "crossterm" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - [[package]] name = "crossterm" version = "0.27.0" @@ -998,15 +982,17 @@ dependencies = [ [[package]] name = "ratatui" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5" +checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad" dependencies = [ "bitflags 2.4.0", "cassowary", - "crossterm 0.26.1", + "crossterm", "indoc", + "itertools", "paste", + "strum", "unicode-segmentation", "unicode-width", ] @@ -1042,9 +1028,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" dependencies = [ "aho-corasick", "memchr", @@ -1054,9 +1040,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" dependencies = [ "aho-corasick", "memchr", @@ -1065,9 +1051,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustc-demangle" @@ -1088,6 +1074,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "rustyline" version = "12.0.0" @@ -1137,9 +1129,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -1156,9 +1148,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -1276,6 +1268,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.29", +] + [[package]] name = "syn" version = "1.0.109" @@ -1323,7 +1337,7 @@ dependencies = [ "chrono", "clap", "clap_complete", - "crossterm 0.27.0", + "crossterm", "dirs", "futures", "itertools", diff --git a/Cargo.toml b/Cargo.toml index 80d5da04..f2df8006 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ anyhow = "1.0.75" better-panic = "0.3.0" cassowary = "0.3.0" chrono = "0.4.26" -clap = { version = "4.4.0", features = ["derive"] } +clap = { version = "4.4.1", features = ["derive"] } crossterm = { version = "0.27.0", features = [ "event-stream", ] } @@ -29,16 +29,16 @@ log = "0.4.20" log4rs = "1.2.0" path-clean = "1.0.1" rand = "0.8.5" -regex = "1.9.3" +regex = "1.9.4" rustyline = { version = "12.0.0", features = ["with-file-history", "derive"] } -serde = { version = "1.0.186", features = ["derive"] } +serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.105" shellexpand = "3.1.0" shlex = "1.1.0" task-hookrs = "0.9.0" tokio = { version = "1.32.0", features = ["full"] } tokio-stream = "0.1.14" -tui = { package = "ratatui", version = "0.22.0" } +ratatui = "0.23.0" unicode-segmentation = "1.10.1" unicode-truncate = "0.2.0" unicode-width = "0.1.10" @@ -60,6 +60,6 @@ incremental = true lto = "off" [build-dependencies] -clap = { version = "4.4.0", features = ["derive"] } +clap = { version = "4.4.1", features = ["derive"] } clap_complete = "4.4.0" shlex = "1.1.0" diff --git a/src/app.rs b/src/app.rs index 9ea3b0e2..82433b46 100644 --- a/src/app.rs +++ b/src/app.rs @@ -22,11 +22,11 @@ use std::io::Write; use std::time::SystemTime; +use ratatui::symbols::bar::FULL; use task_hookrs::date::Date; use task_hookrs::import::import; use task_hookrs::status::TaskStatus; use task_hookrs::task::Task; -use tui::symbols::bar::FULL; use uuid::Uuid; use unicode_segmentation::Graphemes; @@ -42,8 +42,7 @@ use std::sync::mpsc; use std::sync::{Arc, Mutex}; -use std::time::Duration; -use tui::{ +use ratatui::{ backend::Backend, layout::{Alignment, Constraint, Direction, Layout, Margin, Rect}, style::{Color, Modifier, Style}, @@ -51,6 +50,7 @@ use tui::{ text::{Line, Span, Text}, widgets::{Block, BorderType, Borders, Clear, Gauge, LineGauge, List, ListItem, Paragraph, Wrap}, }; +use std::time::Duration; use rustyline::history::SearchDirection as HistoryDirection; use rustyline::line_buffer::LineBuffer; @@ -60,8 +60,8 @@ use rustyline::Word; use crate::history::HistoryContext; +use ratatui::{backend::CrosstermBackend, Terminal}; use std::io; -use tui::{backend::CrosstermBackend, Terminal}; use regex::Regex; @@ -88,7 +88,7 @@ use task_hookrs::project::Project; use versions::Versioning; use log::{debug, error, info, log_enabled, trace, warn, Level, LevelFilter}; -use tui::widgets::Tabs; +use ratatui::widgets::Tabs; const MAX_LINE: usize = 4096; @@ -3732,12 +3732,12 @@ pub fn remove_tag(task: &mut Task, tag: &str) { #[cfg(test)] mod tests { use super::*; + use ratatui::backend::TestBackend; + use ratatui::buffer::Buffer; use std::ffi::OsStr; use std::fs::File; use std::path::Path; use std::{fmt::Write, io}; - use tui::backend::TestBackend; - use tui::buffer::Buffer; /// Returns a string representation of the given buffer for debugging purpose. fn buffer_view(buffer: &Buffer) -> String { diff --git a/src/calendar.rs b/src/calendar.rs index a7058573..896cf08f 100644 --- a/src/calendar.rs +++ b/src/calendar.rs @@ -7,7 +7,7 @@ const COL_WIDTH: usize = 21; use chrono::{format::Fixed, DateTime, Datelike, Duration, FixedOffset, Local, Month, NaiveDate, NaiveDateTime, TimeZone}; -use tui::{ +use ratatui::{ buffer::Buffer, layout::Rect, style::{Color, Modifier, Style}, diff --git a/src/completion.rs b/src/completion.rs index aaa0ba83..0fa37eab 100644 --- a/src/completion.rs +++ b/src/completion.rs @@ -1,12 +1,12 @@ use log::{debug, error, info, log_enabled, trace, warn, Level, LevelFilter}; -use std::{error::Error, io}; -use tui::{ +use ratatui::{ layout::{Constraint, Corner, Direction, Layout}, style::{Color, Modifier, Style}, text::{Line, Span}, widgets::{Block, Borders, List, ListItem, ListState}, Terminal, }; +use std::{error::Error, io}; use rustyline::highlight::{Highlighter, MatchingBracketHighlighter}; use rustyline::hint::Hinter; diff --git a/src/config.rs b/src/config.rs index 5ffefbb2..86867c04 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,12 +1,12 @@ use anyhow::{Context, Result}; -use std::collections::HashMap; -use std::error::Error; -use std::str; -use tui::{ +use ratatui::{ style::{Color, Modifier, Style}, symbols::bar::FULL, symbols::line::DOUBLE_VERTICAL, }; +use std::collections::HashMap; +use std::error::Error; +use std::str; trait TaskWarriorBool { fn get_bool(&self) -> Option; diff --git a/src/help.rs b/src/help.rs index f5749420..01bc2130 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,6 +1,6 @@ use std::cmp; -use tui::{ +use ratatui::{ buffer::Buffer, layout::{Alignment, Rect}, style::{Modifier, Style}, diff --git a/src/main.rs b/src/main.rs index 34d07a66..6030b4e4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,7 @@ use crossterm::{ terminal::{disable_raw_mode, enable_raw_mode, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}, }; use futures::stream::{FuturesUnordered, StreamExt}; -use tui::{backend::CrosstermBackend, Terminal}; +use ratatui::{backend::CrosstermBackend, Terminal}; use path_clean::PathClean; diff --git a/src/pane/context.rs b/src/pane/context.rs index f1dbdd85..5062d1d9 100644 --- a/src/pane/context.rs +++ b/src/pane/context.rs @@ -9,7 +9,7 @@ const ACTIVE: &str = "Complete"; use chrono::{Datelike, Duration, Local, Month, NaiveDate, NaiveDateTime, TimeZone}; -use tui::{ +use ratatui::{ buffer::Buffer, layout::{Alignment, Rect}, style::{Color, Modifier, Style}, diff --git a/src/pane/project.rs b/src/pane/project.rs index 1211ba91..1b12e1c9 100644 --- a/src/pane/project.rs +++ b/src/pane/project.rs @@ -10,7 +10,7 @@ const COMPLETE_HEADER: &str = "Complete"; use chrono::{Datelike, Duration, Local, Month, NaiveDate, NaiveDateTime, TimeZone}; -use tui::{ +use ratatui::{ buffer::Buffer, layout::Rect, style::{Color, Modifier, Style}, diff --git a/src/scrollbar.rs b/src/scrollbar.rs index efe1c34d..4149d91c 100644 --- a/src/scrollbar.rs +++ b/src/scrollbar.rs @@ -1,4 +1,4 @@ -use tui::{ +use ratatui::{ backend::Backend, buffer::Buffer, layout::{Margin, Rect}, diff --git a/src/table.rs b/src/table.rs index b1f9c5e5..9f61fb45 100644 --- a/src/table.rs +++ b/src/table.rs @@ -3,18 +3,18 @@ use cassowary::{ WeightedRelation::{EQ, GE, LE}, {Expression, Solver}, }; +use ratatui::{ + buffer::Buffer, + layout::{Constraint, Rect}, + style::Style, + widgets::{Block, StatefulWidget, Widget}, +}; use std::collections::HashSet; use std::{ collections::HashMap, fmt::Display, iter::{self, Iterator}, }; -use tui::{ - buffer::Buffer, - layout::{Constraint, Rect}, - style::Style, - widgets::{Block, StatefulWidget, Widget}, -}; use unicode_segmentation::Graphemes; use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; @@ -113,9 +113,9 @@ where /// # Examples /// /// ```rust -/// # use tui::widgets::{Block, Borders, Table, Row}; -/// # use tui::layout::Constraint; -/// # use tui::style::{Style, Color}; +/// # use ratatui::widgets::{Block, Borders, Table, Row}; +/// # use ratatui::layout::Constraint; +/// # use ratatui::style::{Style, Color}; /// let row_style = Style::default().fg(Color::White); /// Table::new( /// ["Col1", "Col2", "Col3"].into_iter(), diff --git a/src/ui.rs b/src/ui.rs index 8d38d723..ba18ab4a 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,4 +1,4 @@ -use tui::{ +use ratatui::{ backend::Backend, layout::{Alignment, Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style},