From 42c541ac1977cef5169981c5996820214da9c937 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 4 May 2020 13:27:30 +0800 Subject: Upgrade to tui 0.9 --- Cargo.lock | 20 +++++--------------- Cargo.toml | 4 ++-- src/interactive/widgets/footer.rs | 6 +++--- src/interactive/widgets/header.rs | 2 +- src/interactive/widgets/help.rs | 6 +++--- src/interactive/widgets/mark.rs | 6 +++--- tui-react/Cargo.toml | 4 ++-- tui-react/src/list.rs | 6 +++--- 8 files changed, 22 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86967c0..f3a5e7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,7 @@ dependencies = [ "failure-tools", "filesize", "flume", - "itertools 0.9.0", + "itertools", "jwalk", "log", "num_cpus", @@ -292,15 +292,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.9.0" @@ -600,15 +591,14 @@ dependencies = [ [[package]] name = "tui" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b871b61f4c4b81e630215cd12e0ec29953d4545898e21a9e023b7520a74a9f9" +checksum = "b7de74b91c6cb83119a2140e7c215d95d9e54db27b58a500a2cbdeec4987b0a2" dependencies = [ "bitflags", "cassowary", "either", - "itertools 0.8.2", - "log", + "itertools", "termion", "unicode-segmentation", "unicode-width", @@ -616,7 +606,7 @@ dependencies = [ [[package]] name = "tui-react" -version = "0.3.0" +version = "0.4.0" dependencies = [ "log", "tui", diff --git a/Cargo.toml b/Cargo.toml index c5da4ea..ecb3186 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,12 +17,12 @@ jwalk = "0.5.0" byte-unit = "3" termion = "1.5.2" atty = "0.2.11" -tui = "0.8.0" +tui = "0.9.1" petgraph = "0.5" itertools = "0.9.0" open = "1.2.2" log = "0.4.6" -tui-react = { path = "./tui-react", version = "0.3" } +tui-react = { path = "./tui-react", version = "0.4" } num_cpus = "1.10.0" unicode-segmentation = "1.3.0" filesize = "0.2.0" diff --git a/src/interactive/widgets/footer.rs b/src/interactive/widgets/footer.rs index f89bae5..461580c 100644 --- a/src/interactive/widgets/footer.rs +++ b/src/interactive/widgets/footer.rs @@ -5,9 +5,9 @@ use tui::{ layout::Rect, style::Modifier, style::{Color, Style}, - widgets::Widget, - widgets::{Paragraph, Text}, + widgets::{Paragraph, Text, Widget}, }; + pub struct Footer; pub struct FooterProps { @@ -55,6 +55,6 @@ impl Footer { modifier: Modifier::REVERSED, ..Default::default() }) - .draw(area, buf); + .render(area, buf); } } diff --git a/src/interactive/widgets/header.rs b/src/interactive/widgets/header.rs index 75f72a4..745db3c 100644 --- a/src/interactive/widgets/header.rs +++ b/src/interactive/widgets/header.rs @@ -46,6 +46,6 @@ impl Header { bg: bg_color, ..Default::default() }) - .draw(area, buf); + .render(area, buf); } } diff --git a/src/interactive/widgets/help.rs b/src/interactive/widgets/help.rs index c4af842..d14d8a6 100644 --- a/src/interactive/widgets/help.rs +++ b/src/interactive/widgets/help.rs @@ -194,11 +194,11 @@ impl HelpPane { } = props.borrow(); let title = "Help"; - let mut block = Block::default() + let block = Block::default() .title(title) .border_style(*border_style) .borders(Borders::ALL); - block.draw(area, buf); + block.render(area, buf); if *has_focus { let help_text = " . = o|.. = u || ⇊ = CTRL+d|↓ = j|⇈ = CTRL+u|↑ = k "; @@ -221,6 +221,6 @@ impl HelpPane { self.scroll = self.scroll.min(num_lines.saturating_sub(area.height)); Paragraph::new(texts.iter()) .scroll(self.scroll) - .draw(area, buf); + .render(area, buf); } } diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index ef62f76..1f59738 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -317,13 +317,13 @@ impl MarkPane { Some(marked.len().saturating_sub(1)) } }; - let mut block = Block::default() + let block = Block::default() .title(&title) .border_style(*border_style) .borders(Borders::ALL); let inner_area = block.inner(area); - block.draw(area, buf); + block.render(area, buf); let list_area = if self.has_focus { let (help_line_area, list_area) = { @@ -370,7 +370,7 @@ impl MarkPane { .iter(), ) .style(default_style) - .draw(help_line_area, buf); + .render(help_line_area, buf); list_area } else { inner_area diff --git a/tui-react/Cargo.toml b/tui-react/Cargo.toml index c61cefe..6782a48 100644 --- a/tui-react/Cargo.toml +++ b/tui-react/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tui-react" -version = "0.3.0" +version = "0.4.0" authors = ["Sebastian Thiel "] edition = "2018" repository = "https://github.com/Byron/dua-cli" @@ -9,7 +9,7 @@ readme = "README.md" license = "MIT" [dependencies] -tui = { version = "0.8.0", default-features = false } +tui = { version = "0.9.1", default-features = false } log = "0.4.6" unicode-segmentation = "1.6.0" unicode-width = "0.1.7" diff --git a/tui-react/src/list.rs b/tui-react/src/list.rs index 6c7699a..8ffe88c 100644 --- a/tui-react/src/list.rs +++ b/tui-react/src/list.rs @@ -43,8 +43,8 @@ impl List { } = props; let list_area = match block { - Some(mut b) => { - b.draw(area, buf); + Some(b) => { + b.render(area, buf); b.inner(area) } None => area, @@ -62,7 +62,7 @@ impl List { .take(list_area.height as usize) { let (x, y) = (list_area.left(), list_area.top() + i as u16); - Paragraph::new(text_iterator.iter()).draw( + Paragraph::new(text_iterator.iter()).render( Rect { x, y, -- cgit v1.2.3