From 3ad9536cf452114629b7f53359399855712ff1fc Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Wed, 22 Mar 2023 17:33:03 +0530 Subject: [PATCH] Update deps (#18) * Update dependencies * Fix termion example * Improve termion example * v0.7.0 --- Cargo.toml | 10 +++++----- README.md | 4 ++-- examples/{tui-rs-input => ratatui-input}/.gitignore | 0 examples/{tui-rs-input => ratatui-input}/Cargo.toml | 4 ++-- examples/{tui-rs-input => ratatui-input}/rustfmt.toml | 0 examples/{tui-rs-input => ratatui-input}/src/main.rs | 0 examples/termion_input.rs | 5 ++--- 7 files changed, 11 insertions(+), 12 deletions(-) rename examples/{tui-rs-input => ratatui-input}/.gitignore (100%) rename examples/{tui-rs-input => ratatui-input}/Cargo.toml (86%) rename examples/{tui-rs-input => ratatui-input}/rustfmt.toml (100%) rename examples/{tui-rs-input => ratatui-input}/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 44882bc..1ba9d13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tui-input" -version = "0.6.1" +version = "0.7.0" edition = "2021" authors = ["Arijit Basu "] description = "TUI input library supporting multiple backends" @@ -16,10 +16,10 @@ autoexamples = true default = ["crossterm"] [dependencies] -crossterm = { version = "0.26.0", optional = true } -serde = { version = "1.0.145", optional = true, features = ["derive"] } -termion = { version = "1.5.6", optional = true } -unicode-width = "0.1.4" +crossterm = { version = "0.26.1", optional = true } +serde = { version = "1.0.158", optional = true, features = ["derive"] } +termion = { version = "2.0.1", optional = true } +unicode-width = "0.1.10" [[example]] name = "crossterm_input" diff --git a/README.md b/README.md index bb21869..804dee1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Crate Status](https://img.shields.io/crates/v/tui-input.svg)](https://crates.io/crates/tui-input) [![Docs Status](https://docs.rs/tui-input/badge.svg)](https://docs.rs/tui-input/) -[![tui-input.gif](https://s10.gifyu.com/images/tui-input.gif)](https://github.com/sayanarijit/tui-input/blob/main/examples/tui-rs-input/src/main.rs) +[![tui-input.gif](https://s10.gifyu.com/images/tui-input.gif)](https://github.com/sayanarijit/tui-input/blob/main/examples/ratatui-input/src/main.rs) A TUI input library supporting multiple backends. @@ -41,7 +41,7 @@ cargo run --example crossterm_input cargo run --example termion_input --features termion # Run the tui-rs example -(cd ./examples/tui-rs-input/ && cargo run) +(cd ./examples/ratatui-input/ && cargo run) ``` ## Used in diff --git a/examples/tui-rs-input/.gitignore b/examples/ratatui-input/.gitignore similarity index 100% rename from examples/tui-rs-input/.gitignore rename to examples/ratatui-input/.gitignore diff --git a/examples/tui-rs-input/Cargo.toml b/examples/ratatui-input/Cargo.toml similarity index 86% rename from examples/tui-rs-input/Cargo.toml rename to examples/ratatui-input/Cargo.toml index 6d4d4fa..77e1c05 100644 --- a/examples/tui-rs-input/Cargo.toml +++ b/examples/ratatui-input/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "tui-rs-input" +name = "ratatui-input" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -crossterm = "0.26.0" +crossterm = "0.26.1" tui = { package = "ratatui", version = "0.20.0", features = ["crossterm"] } tui-input = { path = "../../" } unicode-width = "0.1.10" diff --git a/examples/tui-rs-input/rustfmt.toml b/examples/ratatui-input/rustfmt.toml similarity index 100% rename from examples/tui-rs-input/rustfmt.toml rename to examples/ratatui-input/rustfmt.toml diff --git a/examples/tui-rs-input/src/main.rs b/examples/ratatui-input/src/main.rs similarity index 100% rename from examples/tui-rs-input/src/main.rs rename to examples/ratatui-input/src/main.rs diff --git a/examples/termion_input.rs b/examples/termion_input.rs index fb8486e..91568c2 100644 --- a/examples/termion_input.rs +++ b/examples/termion_input.rs @@ -3,7 +3,7 @@ use termion::cursor::{Hide, Show}; use termion::event::{Event, Key}; use termion::input::TermRead; use termion::raw::IntoRawMode; -use termion::screen::AlternateScreen; +use termion::screen::IntoAlternateScreen; use tui_input::backend::termion as backend; use tui_input::backend::termion::EventHandler; use tui_input::Input; @@ -12,8 +12,7 @@ fn main() -> Result<()> { let mut input: Input = "Hello ".into(); { let stdin = stdin(); - let stdout = stdout().into_raw_mode().unwrap(); - let mut stdout = AlternateScreen::from(stdout); + let mut stdout = stdout().into_raw_mode()?.into_alternate_screen()?; write!(&mut stdout, "{}", Hide)?; backend::write(&mut stdout, input.value(), input.cursor(), (0, 0), 15)?;