feat: Update to ratatui v0.21.0

This commit is contained in:
Dheepak Krishnamurthy 2023-05-29 12:58:40 -04:00
parent 1a9dedd0f8
commit f900b205fd
7 changed files with 39 additions and 44 deletions

49
Cargo.lock generated
View file

@ -26,6 +26,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]] [[package]]
name = "android_system_properties" name = "android_system_properties"
version = "0.1.5" version = "0.1.5"
@ -165,13 +171,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.24" version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" checksum = "fdbc37d37da9e5bce8173f3a41b71d9bf3c674deebbaceacd0ebdabde76efb03"
dependencies = [ dependencies = [
"android-tzdata",
"iana-time-zone", "iana-time-zone",
"js-sys", "js-sys",
"num-integer",
"num-traits", "num-traits",
"time", "time",
"wasm-bindgen", "wasm-bindgen",
@ -742,11 +748,10 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.17" version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
dependencies = [ dependencies = [
"cfg-if",
"serde", "serde",
] ]
@ -805,14 +810,14 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.6" version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" checksum = "eebffdb73fe72e917997fad08bdbf31ac50b0fa91cec93e69a0662e4264d454c"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -846,16 +851,6 @@ dependencies = [
"minimal-lexical", "minimal-lexical",
] ]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.15" version = "0.2.15"
@ -886,9 +881,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.17.1" version = "1.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
[[package]] [[package]]
name = "option-ext" name = "option-ext"
@ -1012,9 +1007,9 @@ dependencies = [
[[package]] [[package]]
name = "ratatui" name = "ratatui"
version = "0.20.1" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829" checksum = "ce841e0486e7c2412c3740168ede33adeba8e154a15107b879d8162d77c7174e"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cassowary", "cassowary",
@ -1384,9 +1379,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.28.1" version = "1.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@ -1486,9 +1481,9 @@ dependencies = [
[[package]] [[package]]
name = "versions" name = "versions"
version = "4.1.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee97e1d97bd593fb513912a07691b742361b3dd64ad56f2c694ea2dbfe0665d3" checksum = "32feb3eb91e495efe5b6b2e3ca9d78db603043434a3a398a84b47de28abb2d02"
dependencies = [ dependencies = [
"itertools", "itertools",
"nom", "nom",

View file

@ -20,7 +20,7 @@ crossterm-backend = ["tui/crossterm", "crossterm"]
anyhow = "1.0.71" anyhow = "1.0.71"
better-panic = "0.3.0" better-panic = "0.3.0"
cassowary = "0.3.0" cassowary = "0.3.0"
chrono = "0.4.24" chrono = "0.4.25"
clap = { version = "4.3.0", features = ["derive"] } clap = { version = "4.3.0", features = ["derive"] }
crossterm = { version = "0.26.1", optional = true, default-features = false, features = [ crossterm = { version = "0.26.1", optional = true, default-features = false, features = [
"event-stream", "event-stream",
@ -29,7 +29,7 @@ dirs = "5.0.1"
futures = "0.3.28" futures = "0.3.28"
itertools = "0.10.5" itertools = "0.10.5"
lazy_static = "1.4.0" lazy_static = "1.4.0"
log = "0.4.17" log = "0.4.18"
log4rs = "1.2.0" log4rs = "1.2.0"
path-clean = "1.0.1" path-clean = "1.0.1"
rand = "0.8.5" rand = "0.8.5"
@ -40,14 +40,14 @@ serde_json = "1.0.96"
shellexpand = "3.1.0" shellexpand = "3.1.0"
shlex = "1.1.0" shlex = "1.1.0"
task-hookrs = { git = "https://github.com/kdheepak/task-hookrs" } task-hookrs = { git = "https://github.com/kdheepak/task-hookrs" }
tokio = { version = "1.28.1", features = ["full"] } tokio = { version = "1.28.2", features = ["full"] }
tokio-stream = "0.1.14" tokio-stream = "0.1.14"
tui = { package = "ratatui", version = "0.20.1" } tui = { package = "ratatui", version = "0.21.0" }
unicode-segmentation = "1.10.1" unicode-segmentation = "1.10.1"
unicode-truncate = "0.2.0" unicode-truncate = "0.2.0"
unicode-width = "0.1.10" unicode-width = "0.1.10"
uuid = { version = "1.3.3", features = ["serde", "v4"] } uuid = { version = "1.3.3", features = ["serde", "v4"] }
versions = "4.1.0" versions = "5.0.0"
[package.metadata.rpm] [package.metadata.rpm]
package = "taskwarrior-tui" package = "taskwarrior-tui"

View file

@ -48,7 +48,7 @@ use tui::{
layout::{Alignment, Constraint, Direction, Layout, Margin, Rect}, layout::{Alignment, Constraint, Direction, Layout, Margin, Rect},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
terminal::Frame, terminal::Frame,
text::{Span, Spans, Text}, text::{Span, Line, Text},
widgets::{Block, BorderType, Borders, Clear, Gauge, LineGauge, List, ListItem, Paragraph, Wrap}, widgets::{Block, BorderType, Borders, Clear, Gauge, LineGauge, List, ListItem, Paragraph, Wrap},
}; };
@ -487,14 +487,14 @@ impl TaskwarriorTui {
fn draw_tabs(&self, f: &mut Frame<impl Backend>, layout: Rect) { fn draw_tabs(&self, f: &mut Frame<impl Backend>, layout: Rect) {
let titles: Vec<&str> = vec!["Tasks", "Projects", "Calendar"]; let titles: Vec<&str> = vec!["Tasks", "Projects", "Calendar"];
let tab_names: Vec<_> = titles.into_iter().map(Spans::from).collect(); let tab_names: Vec<_> = titles.into_iter().map(Line::from).collect();
let selected_tab = match self.mode { let selected_tab = match self.mode {
Mode::Tasks(_) => 0, Mode::Tasks(_) => 0,
Mode::Projects => 1, Mode::Projects => 1,
Mode::Calendar => 2, Mode::Calendar => 2,
}; };
let navbar_block = Block::default().style(self.config.uda_style_navbar); let navbar_block = Block::default().style(self.config.uda_style_navbar);
let context = Spans::from(vec![ let context = Line::from(vec![
Span::from("["), Span::from("["),
Span::from(if self.current_context.is_empty() { Span::from(if self.current_context.is_empty() {
"none" "none"
@ -964,7 +964,7 @@ impl TaskwarriorTui {
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_type(BorderType::Rounded) .border_type(BorderType::Rounded)
.title(Spans::from(vec![Span::styled("Context", Style::default().add_modifier(Modifier::BOLD))])), .title(Line::from(vec![Span::styled("Context", Style::default().add_modifier(Modifier::BOLD))])),
) )
.header_style( .header_style(
self self
@ -993,7 +993,7 @@ impl TaskwarriorTui {
.candidates() .candidates()
.iter() .iter()
.map(|p| { .map(|p| {
let lines = vec![Spans::from(vec![ let lines = vec![Line::from(vec![
Span::styled(p.3.clone(), Style::default().add_modifier(Modifier::BOLD)), Span::styled(p.3.clone(), Style::default().add_modifier(Modifier::BOLD)),
Span::from(p.4.clone()), Span::from(p.4.clone()),
])]; ])];
@ -1053,9 +1053,9 @@ impl TaskwarriorTui {
style = style.fg(Color::Red); style = style.fg(Color::Red);
}; };
let title_spans = if let Some(subtitle) = title.1 { let title_spans = if let Some(subtitle) = title.1 {
Spans::from(vec![title.0, Span::from(" ["), subtitle, Span::from("]")]) Line::from(vec![title.0, Span::from(" ["), subtitle, Span::from("]")])
} else { } else {
Spans::from(vec![title.0]) Line::from(vec![title.0])
}; };
let title = Paragraph::new(Text::from(title_spans)).style(style); let title = Paragraph::new(Text::from(title_spans)).style(style);
f.render_widget(title, rects[0]); f.render_widget(title, rects[0]);

View file

@ -3,7 +3,7 @@ use std::{error::Error, io};
use tui::{ use tui::{
layout::{Constraint, Corner, Direction, Layout}, layout::{Constraint, Corner, Direction, Layout},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
text::{Span, Spans}, text::{Span, Line},
widgets::{Block, Borders, List, ListItem, ListState}, widgets::{Block, Borders, List, ListItem, ListState},
Terminal, Terminal,
}; };

View file

@ -4,7 +4,7 @@ use tui::{
buffer::Buffer, buffer::Buffer,
layout::{Alignment, Rect}, layout::{Alignment, Rect},
style::{Modifier, Style}, style::{Modifier, Style},
text::{Span, Spans, Text}, text::{Span, Line, Text},
widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget}, widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget},
}; };
@ -34,7 +34,7 @@ impl Default for Help {
impl Widget for &Help { impl Widget for &Help {
fn render(self, area: Rect, buf: &mut Buffer) { fn render(self, area: Rect, buf: &mut Buffer) {
let text: Vec<Spans> = TEXT.lines().map(|line| Spans::from(format!("{}\n", line))).collect(); let text: Vec<Line> = TEXT.lines().map(|line| Line::from(format!("{}\n", line))).collect();
Paragraph::new(text) Paragraph::new(text)
.block( .block(
Block::default() Block::default()

View file

@ -14,7 +14,7 @@ use tui::{
layout::{Alignment, Rect}, layout::{Alignment, Rect},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
symbols, symbols,
text::{Span, Spans, Text}, text::{Span, Line, Text},
widgets::{Block, BorderType, Borders, Clear, Paragraph, StatefulWidget, Widget}, widgets::{Block, BorderType, Borders, Clear, Paragraph, StatefulWidget, Widget},
}; };

View file

@ -3,7 +3,7 @@ use tui::{
layout::{Alignment, Constraint, Direction, Layout, Rect}, layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
symbols, symbols,
text::{Span, Spans}, text::{Span, Line},
widgets::{Block, BorderType, Borders, Cell, LineGauge, Paragraph, Row, Table}, widgets::{Block, BorderType, Borders, Cell, LineGauge, Paragraph, Row, Table},
Frame, Frame,
}; };