build(deps): Bump to ratatui v0.26

This commit is contained in:
Dheepak Krishnamurthy 2024-05-12 11:19:50 -04:00
parent 6b2365919b
commit e8f3d6501d
5 changed files with 144 additions and 53 deletions

149
Cargo.lock generated
View file

@ -17,6 +17,18 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "aho-corasick"
version = "1.0.4"
@ -26,6 +38,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "allocator-api2"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]]
name = "android-tzdata"
version = "0.1.1"
@ -162,6 +180,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "castaway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]]
name = "cc"
version = "1.0.83"
@ -233,7 +260,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -259,6 +286,19 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "compact_str"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
dependencies = [
"castaway",
"cfg-if",
"itoa",
"ryu",
"static_assertions",
]
[[package]]
name = "console"
version = "0.15.7"
@ -529,7 +569,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -585,6 +625,16 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"allocator-api2",
]
[[package]]
name = "heck"
version = "0.4.1"
@ -648,7 +698,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown",
"hashbrown 0.12.3",
]
[[package]]
@ -666,6 +716,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.9"
@ -756,6 +815,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "lru"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc"
dependencies = [
"hashbrown 0.14.5",
]
[[package]]
name = "memchr"
version = "2.5.0"
@ -982,16 +1050,19 @@ dependencies = [
[[package]]
name = "ratatui"
version = "0.23.0"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
checksum = "a564a852040e82671dc50a37d88f3aa83bbc690dfc6844cfe7a2591620206a80"
dependencies = [
"bitflags 2.4.0",
"cassowary",
"compact_str",
"crossterm",
"indoc",
"itertools",
"itertools 0.12.1",
"lru",
"paste",
"stability",
"strum",
"unicode-segmentation",
"unicode-width",
@ -1112,7 +1183,7 @@ checksum = "5a32af5427251d2e4be14fc151eabe18abb4a7aad5efee7044da9f096c906a43"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -1154,7 +1225,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -1250,6 +1321,16 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "stability"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ff9eaf853dec4c8802325d8b6d3dffa86cc707fd7a1a4cdbf416e13b061787a"
dependencies = [
"quote",
"syn 2.0.32",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
@ -1270,24 +1351,24 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strum"
version = "0.25.0"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.25.2"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059"
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -1303,9 +1384,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.29"
version = "2.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2"
dependencies = [
"proc-macro2",
"quote",
@ -1340,7 +1421,7 @@ dependencies = [
"crossterm",
"dirs",
"futures",
"itertools",
"itertools 0.11.0",
"lazy_static",
"log",
"log4rs",
@ -1380,7 +1461,7 @@ checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -1432,7 +1513,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
]
[[package]]
@ -1507,13 +1588,19 @@ dependencies = [
"serde",
]
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "versions"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c73a36bc44e3039f51fbee93e39f41225f6b17b380eb70cc2aab942df06b34dd"
dependencies = [
"itertools",
"itertools 0.11.0",
"nom",
]
@ -1550,7 +1637,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
"wasm-bindgen-shared",
]
@ -1572,7 +1659,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
"syn 2.0.32",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -1754,3 +1841,23 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "zerocopy"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.32",
]

View file

@ -36,7 +36,7 @@ shlex = "1.1.0"
task-hookrs = "0.9.0"
tokio = { version = "1.32.0", features = ["full"] }
tokio-stream = "0.1.14"
ratatui = "0.23.0"
ratatui = "0.26"
unicode-segmentation = "1.10.1"
unicode-truncate = "0.2.0"
unicode-width = "0.1.10"

View file

@ -434,7 +434,7 @@ impl TaskwarriorTui {
Ok(())
}
pub fn draw(&mut self, f: &mut Frame<impl Backend>) {
pub fn draw(&mut self, f: &mut Frame) {
let rect = f.size();
self.terminal_width = rect.width;
self.terminal_height = rect.height;
@ -455,7 +455,7 @@ impl TaskwarriorTui {
}
}
fn draw_tabs(&self, f: &mut Frame<impl Backend>, layout: Rect) {
fn draw_tabs(&self, f: &mut Frame, layout: Rect) {
let titles: Vec<&str> = vec!["Tasks", "Projects", "Calendar"];
let tab_names: Vec<_> = titles.into_iter().map(Line::from).collect();
let selected_tab = match self.mode {
@ -487,7 +487,7 @@ impl TaskwarriorTui {
f.render_widget(Paragraph::new(Text::from(context)).block(navbar_block), rects[1]);
}
pub fn draw_debug(&mut self, f: &mut Frame<impl Backend>) {
pub fn draw_debug(&mut self, f: &mut Frame) {
let area = centered_rect(50, 50, f.size());
f.render_widget(Clear, area);
let t = format!("{}", self.current_selection);
@ -495,7 +495,7 @@ impl TaskwarriorTui {
f.render_widget(p, area);
}
pub fn draw_projects(&mut self, f: &mut Frame<impl Backend>, rect: Rect) {
pub fn draw_projects(&mut self, f: &mut Frame, rect: Rect) {
let data = self.projects.data.clone();
let p = Paragraph::new(Text::from(&data[..]));
f.render_widget(p, rect);
@ -521,7 +521,7 @@ impl TaskwarriorTui {
style
}
pub fn draw_calendar(&mut self, f: &mut Frame<impl Backend>, layout: Rect) {
pub fn draw_calendar(&mut self, f: &mut Frame, layout: Rect) {
let mut c = Calendar::default()
.today_style(self.config.uda_style_calendar_today)
.year(self.calendar_year)
@ -532,7 +532,7 @@ impl TaskwarriorTui {
f.render_widget(c, layout);
}
pub fn draw_task(&mut self, f: &mut Frame<impl Backend>, layout: Rect, action: Action) {
pub fn draw_task(&mut self, f: &mut Frame, layout: Rect, action: Action) {
let rects = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Min(0), Constraint::Length(2)].as_ref())
@ -576,7 +576,7 @@ impl TaskwarriorTui {
self.handle_task_mode_action(f, &rects, &task_ids, action);
}
fn handle_task_mode_action(&mut self, f: &mut Frame<impl Backend>, rects: &[Rect], task_ids: &[String], action: Action) {
fn handle_task_mode_action(&mut self, f: &mut Frame, rects: &[Rect], task_ids: &[String], action: Action) {
match action {
Action::Error => {
self.draw_command(
@ -888,7 +888,7 @@ impl TaskwarriorTui {
position
}
fn draw_help_popup(&mut self, f: &mut Frame<impl Backend>, percent_x: u16, percent_y: u16) {
fn draw_help_popup(&mut self, f: &mut Frame, percent_x: u16, percent_y: u16) {
let area = centered_rect(percent_x, percent_y, f.size());
f.render_widget(Clear, area);
@ -913,7 +913,7 @@ impl TaskwarriorTui {
f.render_widget(&self.help_popup, chunks[0]);
}
fn draw_context_menu(&mut self, f: &mut Frame<impl Backend>, percent_x: u16, percent_y: u16) {
fn draw_context_menu(&mut self, f: &mut Frame, percent_x: u16, percent_y: u16) {
let rects = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Min(0)].as_ref())
@ -972,7 +972,7 @@ impl TaskwarriorTui {
f.render_stateful_widget(t, area, &mut self.contexts.table_state);
}
fn draw_completion_pop_up(&mut self, f: &mut Frame<impl Backend>, rect: Rect, cursor_position: usize) {
fn draw_completion_pop_up(&mut self, f: &mut Frame, rect: Rect, cursor_position: usize) {
if self.completion_list.candidates().is_empty() {
self.show_completion_pane = false;
return;
@ -1018,16 +1018,7 @@ impl TaskwarriorTui {
f.render_stateful_widget(items, rect, &mut self.completion_list.state);
}
fn draw_command(
&self,
f: &mut Frame<impl Backend>,
rect: Rect,
text: &str,
title: (Span, Option<Span>),
position: usize,
cursor: bool,
error: Option<String>,
) {
fn draw_command(&self, f: &mut Frame, rect: Rect, text: &str, title: (Span, Option<Span>), position: usize, cursor: bool, error: Option<String>) {
// f.render_widget(Clear, rect);
if cursor {
f.set_cursor(std::cmp::min(rect.x + position as u16, rect.x + rect.width.saturating_sub(2)), rect.y + 1);
@ -1055,7 +1046,7 @@ impl TaskwarriorTui {
f.render_widget(p, rects[1]);
}
fn draw_task_details(&mut self, f: &mut Frame<impl Backend>, rect: Rect) {
fn draw_task_details(&mut self, f: &mut Frame, rect: Rect) {
if self.tasks.is_empty() {
let p = Paragraph::new(Text::from("Task not found")).block(Block::default().borders(Borders::TOP));
f.render_widget(p, rect);
@ -1197,15 +1188,10 @@ impl TaskwarriorTui {
widths
}
fn draw_task_report(&mut self, f: &mut Frame<impl Backend>, rect: Rect) {
fn draw_task_report(&mut self, f: &mut Frame, rect: Rect) {
let (tasks, headers) = self.get_task_report();
if tasks.is_empty() {
if !self.current_context.is_empty() {
let context_style = Style::default();
context_style.add_modifier(Modifier::ITALIC);
}
f.render_widget(Block::default(), rect);
return;
}

View file

@ -337,6 +337,7 @@ where
Constraint::Ratio(n, d) => variables[i] | EQ(WEAK) | (f64::from(area.width) * f64::from(n) / f64::from(d)),
Constraint::Min(v) => variables[i] | GE(WEAK) | f64::from(v),
Constraint::Max(v) => variables[i] | LE(WEAK) | f64::from(v),
Constraint::Fill(v) => variables[i] | EQ(WEAK) | f64::from(v),
});
}
solver

View file

@ -10,10 +10,7 @@ use ratatui::{
use crate::app::TaskwarriorTui;
pub fn draw<B>(rect: &mut Frame<B>, app: &TaskwarriorTui)
where
B: Backend,
{
pub fn draw(rect: &mut Frame, app: &TaskwarriorTui) {
let size = rect.size();
let chunks = Layout::default()
.direction(Direction::Vertical)