From a61b078dea36f526a32c2b3738dc3462e8a15c15 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 24 Apr 2022 20:25:50 +0800 Subject: [PATCH 01/13] chore: fix clippy warning (#601) --- src/widgets/reflow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/reflow.rs b/src/widgets/reflow.rs index 16760fa..c611299 100644 --- a/src/widgets/reflow.rs +++ b/src/widgets/reflow.rs @@ -489,7 +489,7 @@ mod test { assert_eq!(word_wrapper, vec!["AAAAAAAAAAAAAAA", "AAAA\u{00a0}AAA",]); // Ensure that if the character was a regular space, it would be wrapped differently. - let text_space = text.replace("\u{00a0}", " "); + let text_space = text.replace('\u{00a0}', " "); let (word_wrapper_space, _) = run_composer(Composer::WordWrapper { trim: true }, &text_space, width); assert_eq!(word_wrapper_space, vec!["AAAAAAAAAAAAAAA AAAA", "AAA",]); From ed0ae81aaef466400e9616826d43bed0c2951b81 Mon Sep 17 00:00:00 2001 From: Atk Date: Sun, 24 Apr 2022 13:47:54 +0100 Subject: [PATCH 02/13] chore: update crossterm to v0.23 (#598) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c4a847f..99be52d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ cassowary = "0.3" unicode-segmentation = "1.2" unicode-width = "0.1" termion = { version = "1.5", optional = true } -crossterm = { version = "0.22", optional = true } +crossterm = { version = "0.23", optional = true } serde = { version = "1", optional = true, features = ["derive"]} [dev-dependencies] From e71faa988ea370bc7bd3381e2cd60461cec8dbe8 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 24 Apr 2022 14:57:12 +0200 Subject: [PATCH 03/13] Release v0.18.0 --- CHANGELOG.md | 6 ++++++ Cargo.toml | 4 ++-- README.md | 24 ++++++++++++------------ src/lib.rs | 6 +++--- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0305635..d876173 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## To be released +## v0.18.0 - 2022-04-24 + +### Features + +* Update `crossterm` to `0.23` + ## v0.17.0 - 2022-01-22 ### Features diff --git a/Cargo.toml b/Cargo.toml index 99be52d..a516774 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "tui" -version = "0.17.0" +version = "0.18.0" authors = ["Florian Dehau "] description = """ A library to build rich terminal user interfaces or dashboards """ -documentation = "https://docs.rs/tui/0.17.0/tui/" +documentation = "https://docs.rs/tui/0.18.0/tui/" keywords = ["tui", "terminal", "dashboard"] repository = "https://github.com/fdehau/tui-rs" readme = "README.md" diff --git a/README.md b/README.md index fb2be0d..c9478f7 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ cargo run --example demo --no-default-features --features=termion --release -- - where `tick-rate` is the UI refresh rate in ms. -The UI code is in [examples/demo/ui.rs](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/demo/ui.rs) while the -application state is in [examples/demo/app.rs](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/demo/app.rs). +The UI code is in [examples/demo/ui.rs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/demo/ui.rs) while the +application state is in [examples/demo/app.rs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/demo/app.rs). If the user interface contains glyphs that are not displayed correctly by your terminal, you may want to run the demo without those symbols: @@ -59,16 +59,16 @@ cargo run --example demo --release -- --tick-rate 200 --enhanced-graphics false The library comes with the following list of widgets: - * [Block](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/block.rs) - * [Gauge](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/gauge.rs) - * [Sparkline](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/sparkline.rs) - * [Chart](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/chart.rs) - * [BarChart](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/barchart.rs) - * [List](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/list.rs) - * [Table](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/table.rs) - * [Paragraph](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/paragraph.rs) - * [Canvas (with line, point cloud, map)](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/canvas.rs) - * [Tabs](https://github.com/fdehau/tui-rs/blob/v0.17.0/examples/tabs.rs) + * [Block](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/block.rs) + * [Gauge](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/gauge.rs) + * [Sparkline](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/sparkline.rs) + * [Chart](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/chart.rs) + * [BarChart](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/barchart.rs) + * [List](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/list.rs) + * [Table](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/table.rs) + * [Paragraph](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/paragraph.rs) + * [Canvas (with line, point cloud, map)](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/canvas.rs) + * [Tabs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/tabs.rs) Click on each item to see the source of the example. Run the examples with with cargo (e.g. to run the gauge example `cargo run --example gauge`), and quit by pressing `q`. diff --git a/src/lib.rs b/src/lib.rs index b9d140a..8938884 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,8 @@ //! //! ```toml //! [dependencies] -//! tui = "0.17" -//! crossterm = "0.22" +//! tui = "0.18" +//! crossterm = "0.23" //! ``` //! //! The crate is using the `crossterm` backend by default that works on most platforms. But if for @@ -20,7 +20,7 @@ //! ```toml //! [dependencies] //! termion = "1.5" -//! tui = { version = "0.17", default-features = false, features = ['termion'] } +//! tui = { version = "0.18", default-features = false, features = ['termion'] } //! //! ``` //! From 90d8cb65261247d87fe5f096c32635c1b2049d9c Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 24 Apr 2022 15:37:55 +0200 Subject: [PATCH 04/13] chore: add more apps using `tui` to the README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index c9478f7..25b24c0 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,13 @@ You can run all examples by running `cargo make run-examples` (require * [joshuto](https://github.com/kamiyaa/joshuto) * [adsb_deku/radar](https://github.com/wcampbell0x2a/adsb_deku#radar-tui) * [hoard](https://github.com/Hyde46/hoard) +* [tokio-console](https://github.com/tokio-rs/console): a diagnostics and debugging tool for asynchronous Rust programs. +* [hwatch](https://github.com/blacknon/hwatch): a alternative watch command that records the result of command execution and can display its history and diffs. +* [ytui-music](https://github.com/sudipghimire533/ytui-music): listen to music from youtube inside your terminal. +* [mqttui](https://github.com/EdJoPaTo/mqttui): subscribe or publish to a MQTT Topic quickly from the terminal. +* [meteo-tui](https://github.com/16arpi/meteo-tui): french weather via the command line. +* [picterm](https://github.com/ksk001100/picterm): preview images in your terminal. +* [gobang](https://github.com/TaKO8Ki/gobang): a cross-platform TUI database management tool. ### Alternatives From a6b25a487786534205d818a76acb3989658ae58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=AB=20Christian=20Krause=20=E2=99=AB?= Date: Sun, 24 Apr 2022 16:49:57 +0200 Subject: [PATCH 05/13] chore: add panic hook example (#593) Without a terminal-resetting panic hook there are two main problems when an application panics: 1. The report of the panic is distorted because the terminal has not properly left the alternate screen and is still in raw mode. 2. The terminal needs to be manually reset with the `reset` command. To avoid this, the standard panic hook can be extended to first reset the terminal. --- Cargo.toml | 4 ++ examples/panic.rs | 142 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 examples/panic.rs diff --git a/Cargo.toml b/Cargo.toml index a516774..2e17bae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,10 @@ required-features = ["crossterm"] name = "list" required-features = ["crossterm"] +[[example]] +name = "panic" +required-features = ["crossterm"] + [[example]] name = "paragraph" required-features = ["crossterm"] diff --git a/examples/panic.rs b/examples/panic.rs new file mode 100644 index 0000000..057ee4d --- /dev/null +++ b/examples/panic.rs @@ -0,0 +1,142 @@ +//! How to use a panic hook to reset the terminal before printing the panic to +//! the terminal. +//! +//! When exiting normally or when handling `Result::Err`, we can reset the +//! terminal manually at the end of `main` just before we print the error. +//! +//! Because a panic interrupts the normal control flow, manually resetting the +//! terminal at the end of `main` won't do us any good. Instead, we need to +//! make sure to set up a panic hook that first resets the terminal before +//! handling the panic. This both reuses the standard panic hook to ensure a +//! consistent panic handling UX and properly resets the terminal to not +//! distort the output. +//! +//! That's why this example is set up to show both situations, with and without +//! the chained panic hook, to see the difference. + +#![deny(clippy::all)] +#![warn(clippy::pedantic, clippy::nursery)] + +use std::error::Error; +use std::io; + +use crossterm::event::{self, Event, KeyCode}; +use crossterm::terminal::{disable_raw_mode, enable_raw_mode}; +use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen}; + +use tui::backend::{Backend, CrosstermBackend}; +use tui::layout::Alignment; +use tui::text::Spans; +use tui::widgets::{Block, Borders, Paragraph}; +use tui::{Frame, Terminal}; + +type Result = std::result::Result>; + +#[derive(Default)] +struct App { + hook_enabled: bool, +} + +impl App { + fn chain_hook(&mut self) { + let original_hook = std::panic::take_hook(); + + std::panic::set_hook(Box::new(move |panic| { + reset_terminal().unwrap(); + original_hook(panic); + })); + + self.hook_enabled = true; + } +} + +fn main() -> Result<()> { + let mut terminal = init_terminal()?; + + let mut app = App::default(); + let res = run_tui(&mut terminal, &mut app); + + reset_terminal()?; + + if let Err(err) = res { + println!("{:?}", err); + } + + Ok(()) +} + +/// Initializes the terminal. +fn init_terminal() -> Result>> { + crossterm::execute!(io::stdout(), EnterAlternateScreen)?; + enable_raw_mode()?; + + let backend = CrosstermBackend::new(io::stdout()); + + let mut terminal = Terminal::new(backend)?; + terminal.hide_cursor()?; + + Ok(terminal) +} + +/// Resets the terminal. +fn reset_terminal() -> Result<()> { + disable_raw_mode()?; + crossterm::execute!(io::stdout(), LeaveAlternateScreen)?; + + Ok(()) +} + +/// Runs the TUI loop. +fn run_tui(terminal: &mut Terminal, app: &mut App) -> io::Result<()> { + loop { + terminal.draw(|f| ui(f, app))?; + + if let Event::Key(key) = event::read()? { + match key.code { + KeyCode::Char('p') => { + panic!("intentional demo panic"); + } + + KeyCode::Char('e') => { + app.chain_hook(); + } + + _ => { + return Ok(()); + } + } + } + } +} + +/// Render the TUI. +fn ui(f: &mut Frame, app: &App) { + let text = vec![ + if app.hook_enabled { + Spans::from("HOOK IS CURRENTLY **ENABLED**") + } else { + Spans::from("HOOK IS CURRENTLY **DISABLED**") + }, + Spans::from(""), + Spans::from("press `p` to panic"), + Spans::from("press `e` to enable the terminal-resetting panic hook"), + Spans::from("press any other key to quit without panic"), + Spans::from(""), + Spans::from("when you panic without the chained hook,"), + Spans::from("you will likely have to reset your terminal afterwards"), + Spans::from("with the `reset` command"), + Spans::from(""), + Spans::from("with the chained panic hook enabled,"), + Spans::from("you should see the panic report as you would without tui"), + Spans::from(""), + Spans::from("try first without the panic handler to see the difference"), + ]; + + let b = Block::default() + .title("Panic Handler Demo") + .borders(Borders::ALL); + + let p = Paragraph::new(text).block(b).alignment(Alignment::Center); + + f.render_widget(p, f.size()); +} From ba5ea2deff72fbfd568d4589bfd7ff627959e8cc Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 13:58:53 +0200 Subject: [PATCH 06/13] chore: update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 25b24c0..7cf114d 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ comes from the terminal emulator than the library itself. Moreover, the library does not provide any input handling nor any event system and you may rely on the previously cited libraries to achieve such features. +**I'm actively looking for help maintaining this crate. See [this issue](https://github.com/fdehau/tui-rs/issues/654)** + ### Rust version requirements Since version 0.17.0, `tui` requires **rustc version 1.56.1 or greater**. From faa69b6cfe034ec302253d7b5c75c25cc2c376e8 Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Tue, 19 Jul 2022 18:08:11 +0900 Subject: [PATCH 07/13] chore: explicitly set MSRV to 1.56.1 in Cargo.toml --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 2e17bae..1816538 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ license = "MIT" exclude = ["assets/*", ".github", "Makefile.toml", "CONTRIBUTING.md", "*.log", "tags"] autoexamples = true edition = "2021" +rust-version = "1.56.1" [badges] From a67706bea0b342a92f391bd34425c5b1a42ceff0 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 14:42:47 +0200 Subject: [PATCH 08/13] chore(ci): bump cargo-make to v0.35.16 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4676b1c..d06c60d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: name: CI env: - CI_CARGO_MAKE_VERSION: 0.35.8 + CI_CARGO_MAKE_VERSION: 0.35.16 jobs: linux: From eee37011a543d2e1a9373f304819512ccf3e80d0 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 14:37:08 +0200 Subject: [PATCH 09/13] chore: fix clippy warnings --- src/buffer.rs | 4 ++-- src/layout.rs | 2 +- src/style.rs | 4 ++-- src/text.rs | 8 ++++---- src/widgets/block.rs | 4 ++-- src/widgets/list.rs | 2 +- src/widgets/table.rs | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index b856376..c9cbb04 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -8,7 +8,7 @@ use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; /// A buffer cell -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Cell { pub symbol: String, pub fg: Color, @@ -105,7 +105,7 @@ impl Default for Cell { /// buf.get_mut(5, 0).set_char('x'); /// assert_eq!(buf.get(5, 0).symbol, "x"); /// ``` -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Buffer { /// The area represented by this buffer pub area: Rect, diff --git a/src/layout.rs b/src/layout.rs index 624c22b..651e174 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -51,7 +51,7 @@ pub struct Margin { pub horizontal: u16, } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Alignment { Left, Center, diff --git a/src/style.rs b/src/style.rs index 8a260f6..2c834ec 100644 --- a/src/style.rs +++ b/src/style.rs @@ -2,7 +2,7 @@ use bitflags::bitflags; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Color { Reset, @@ -115,7 +115,7 @@ bitflags! { /// buffer.get(0, 0).style(), /// ); /// ``` -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Style { pub fg: Option, diff --git a/src/text.rs b/src/text.rs index 7d99343..2489597 100644 --- a/src/text.rs +++ b/src/text.rs @@ -52,14 +52,14 @@ use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; /// A grapheme associated to a style. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct StyledGrapheme<'a> { pub symbol: &'a str, pub style: Style, } /// A string where all graphemes have the same style. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Span<'a> { pub content: Cow<'a, str>, pub style: Style, @@ -194,7 +194,7 @@ impl<'a> From<&'a str> for Span<'a> { } /// A string composed of clusters of graphemes, each with their own style. -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Default, Eq)] pub struct Spans<'a>(pub Vec>); impl<'a> Spans<'a> { @@ -273,7 +273,7 @@ impl<'a> From> for String { /// text.extend(Text::styled("Some more lines\nnow with more style!", style)); /// assert_eq!(6, text.height()); /// ``` -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Default, Eq)] pub struct Text<'a> { pub lines: Vec>, } diff --git a/src/widgets/block.rs b/src/widgets/block.rs index ae5b58a..640a80b 100644 --- a/src/widgets/block.rs +++ b/src/widgets/block.rs @@ -7,7 +7,7 @@ use crate::{ widgets::{Borders, Widget}, }; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum BorderType { Plain, Rounded, @@ -41,7 +41,7 @@ impl BorderType { /// .border_type(BorderType::Rounded) /// .style(Style::default().bg(Color::Black)); /// ``` -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Block<'a> { /// Optional title place on the upper left of the block title: Option>, diff --git a/src/widgets/list.rs b/src/widgets/list.rs index b0279d7..d785d54 100644 --- a/src/widgets/list.rs +++ b/src/widgets/list.rs @@ -26,7 +26,7 @@ impl ListState { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ListItem<'a> { content: Text<'a>, style: Style, diff --git a/src/widgets/table.rs b/src/widgets/table.rs index f696114..e1b1bf6 100644 --- a/src/widgets/table.rs +++ b/src/widgets/table.rs @@ -31,7 +31,7 @@ use unicode_width::UnicodeWidthStr; /// /// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling /// capabilities of [`Text`]. -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Cell<'a> { content: Text<'a>, style: Style, @@ -86,7 +86,7 @@ where /// ``` /// /// By default, a row has a height of 1 but you can change this using [`Row::height`]. -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Row<'a> { cells: Vec>, height: u16, @@ -186,7 +186,7 @@ impl<'a> Row<'a> { /// // ...and potentially show a symbol in front of the selection. /// .highlight_symbol(">>"); /// ``` -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Table<'a> { /// A block to wrap the widget in block: Option>, From 24de2f8a96970d871330597dd719cef8f482e343 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 15:07:05 +0200 Subject: [PATCH 10/13] chore: bump crossterm to v0.25 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1816538..06e75be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ cassowary = "0.3" unicode-segmentation = "1.2" unicode-width = "0.1" termion = { version = "1.5", optional = true } -crossterm = { version = "0.23", optional = true } +crossterm = { version = "0.25", optional = true } serde = { version = "1", optional = true, features = ["derive"]} [dev-dependencies] From a05fd4595956676404e9edb94f8532bfea1669ea Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 15:27:06 +0200 Subject: [PATCH 11/13] Release v0.19.0 --- CHANGELOG.md | 6 ++++++ Cargo.toml | 4 ++-- README.md | 24 ++++++++++++------------ src/lib.rs | 6 +++--- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d876173..81fb5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## To be released +## v0.19.0 - 2022-08-14 + +### Features + +* Bump `crossterm` to `0.25` + ## v0.18.0 - 2022-04-24 ### Features diff --git a/Cargo.toml b/Cargo.toml index 06e75be..fada5c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "tui" -version = "0.18.0" +version = "0.19.0" authors = ["Florian Dehau "] description = """ A library to build rich terminal user interfaces or dashboards """ -documentation = "https://docs.rs/tui/0.18.0/tui/" +documentation = "https://docs.rs/tui/0.19.0/tui/" keywords = ["tui", "terminal", "dashboard"] repository = "https://github.com/fdehau/tui-rs" readme = "README.md" diff --git a/README.md b/README.md index 7cf114d..cbc930c 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ cargo run --example demo --no-default-features --features=termion --release -- - where `tick-rate` is the UI refresh rate in ms. -The UI code is in [examples/demo/ui.rs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/demo/ui.rs) while the -application state is in [examples/demo/app.rs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/demo/app.rs). +The UI code is in [examples/demo/ui.rs](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/demo/ui.rs) while the +application state is in [examples/demo/app.rs](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/demo/app.rs). If the user interface contains glyphs that are not displayed correctly by your terminal, you may want to run the demo without those symbols: @@ -61,16 +61,16 @@ cargo run --example demo --release -- --tick-rate 200 --enhanced-graphics false The library comes with the following list of widgets: - * [Block](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/block.rs) - * [Gauge](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/gauge.rs) - * [Sparkline](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/sparkline.rs) - * [Chart](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/chart.rs) - * [BarChart](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/barchart.rs) - * [List](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/list.rs) - * [Table](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/table.rs) - * [Paragraph](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/paragraph.rs) - * [Canvas (with line, point cloud, map)](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/canvas.rs) - * [Tabs](https://github.com/fdehau/tui-rs/blob/v0.18.0/examples/tabs.rs) + * [Block](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/block.rs) + * [Gauge](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/gauge.rs) + * [Sparkline](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/sparkline.rs) + * [Chart](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/chart.rs) + * [BarChart](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/barchart.rs) + * [List](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/list.rs) + * [Table](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/table.rs) + * [Paragraph](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/paragraph.rs) + * [Canvas (with line, point cloud, map)](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/canvas.rs) + * [Tabs](https://github.com/fdehau/tui-rs/blob/v0.19.0/examples/tabs.rs) Click on each item to see the source of the example. Run the examples with with cargo (e.g. to run the gauge example `cargo run --example gauge`), and quit by pressing `q`. diff --git a/src/lib.rs b/src/lib.rs index 8938884..50ce8d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,8 @@ //! //! ```toml //! [dependencies] -//! tui = "0.18" -//! crossterm = "0.23" +//! tui = "0.19" +//! crossterm = "0.25" //! ``` //! //! The crate is using the `crossterm` backend by default that works on most platforms. But if for @@ -20,7 +20,7 @@ //! ```toml //! [dependencies] //! termion = "1.5" -//! tui = { version = "0.18", default-features = false, features = ['termion'] } +//! tui = { version = "0.19", default-features = false, features = ['termion'] } //! //! ``` //! From a4de409235feba9f4e47f0fd39406adaf3862d70 Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 14 Aug 2022 15:51:04 +0200 Subject: [PATCH 12/13] chore: add apps using `tui` --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index cbc930c..2fe2e25 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,8 @@ You can run all examples by running `cargo make run-examples` (require ### Third-party widgets * [tui-logger](https://github.com/gin66/tui-logger) +* [tui-textarea](https://github.com/rhysd/tui-textarea): simple yet powerful multi-line text editor widget supporting several key shortcuts, undo/redo, text search, etc. +* [tui-rs-tree-widgets](https://github.com/EdJoPaTo/tui-rs-tree-widget): widget for tree data structures. ### Apps using tui @@ -117,6 +119,10 @@ You can run all examples by running `cargo make run-examples` (require * [meteo-tui](https://github.com/16arpi/meteo-tui): french weather via the command line. * [picterm](https://github.com/ksk001100/picterm): preview images in your terminal. * [gobang](https://github.com/TaKO8Ki/gobang): a cross-platform TUI database management tool. +* [oxker](https://github.com/mrjackwills/oxker): a simple tui to view & control docker containers. +* [trippy](https://github.com/fujiapple852/trippy): a network diagnostic tool. +* [cotp](https://github.com/replydev/cotp): a trustworthy, encrypted, command-line TOTP/HOTP authenticator app with import functionality. +* [hg-tui](https://github.com/kaixinbaba/hg-tui): view [hellogithub.com](https://hellogithub.com/) website on the terminal. ### Alternatives From fafad6c96109610825aad89c4bba5253e01101ed Mon Sep 17 00:00:00 2001 From: davidhelbig <52451401+davidhelbig@users.noreply.github.com> Date: Sun, 14 Aug 2022 15:58:02 +0200 Subject: [PATCH 13/13] chore: fix typo in layout.rs (#619) --- src/layout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layout.rs b/src/layout.rs index 651e174..e724d5b 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -361,7 +361,7 @@ impl Element { } } -/// A simple rectangle used in the computation of the layout and to give widgets an hint about the +/// A simple rectangle used in the computation of the layout and to give widgets a hint about the /// area they are supposed to render to. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Default)] pub struct Rect {