Bump crossterm to 0.27.0 (#625)

* Bump `crossterm` to 0.27.0

Waiting for nushell as ratatui (used in nu-explore) is still on 0.26

* Cargo fmt

* Fix examples
This commit is contained in:
Stefan Holderbach 2023-08-28 21:08:10 +02:00 committed by GitHub
parent 6143b01b7b
commit 31257a4c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 25 deletions

9
Cargo.lock generated
View File

@ -60,6 +60,9 @@ name = "bitflags"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
dependencies = [
"serde",
]
[[package]]
name = "block"
@ -194,11 +197,11 @@ dependencies = [
[[package]]
name = "crossterm"
version = "0.26.1"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.3.3",
"crossterm_winapi",
"libc",
"mio",

View File

@ -16,7 +16,7 @@ doctest = true
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
clipboard = { version = "0.5.0", optional = true }
crossbeam = { version = "0.8.2", optional = true }
crossterm = { version = "0.26.1", features = ["serde"] }
crossterm = { version = "0.27.0", features = ["serde"] }
fd-lock = "3.0.3"
itertools = "0.10.3"
nu-ansi-term = "0.49.0"

View File

@ -2,7 +2,7 @@ use {
crossterm::{
cursor::SetCursorStyle,
event::{DisableBracketedPaste, KeyCode, KeyModifiers},
execute, Result,
execute,
},
nu_ansi_term::{Color, Style},
reedline::{
@ -18,7 +18,7 @@ use reedline::CursorConfig;
#[cfg(not(any(feature = "sqlite", feature = "sqlite-dynlib")))]
use reedline::FileBackedHistory;
fn main() -> Result<()> {
fn main() -> std::io::Result<()> {
println!("Ctrl-D to quit");
// quick command like parameter handling
let vi_mode = matches!(std::env::args().nth(1), Some(x) if x == "--vi");

View File

@ -1,7 +1,7 @@
use {
crossterm::{
event::{poll, Event, KeyCode, KeyEvent},
terminal, Result,
terminal,
},
std::{
io::{stdout, Write},
@ -9,7 +9,7 @@ use {
},
};
fn main() -> Result<()> {
fn main() -> std::io::Result<()> {
println!("Ready to print events (Abort with ESC):");
print_events()?;
println!();
@ -17,7 +17,7 @@ fn main() -> Result<()> {
}
/// **For debugging purposes only:** Track the terminal events observed by [`Reedline`] and print them.
pub fn print_events() -> Result<()> {
pub fn print_events() -> std::io::Result<()> {
stdout().flush()?;
terminal::enable_raw_mode()?;
let result = print_events_helper();
@ -31,7 +31,7 @@ pub fn print_events() -> Result<()> {
// even seeing the events. if you press a key and no events
// are printed, it's a good chance your terminal is eating
// those events.
fn print_events_helper() -> Result<()> {
fn print_events_helper() -> std::io::Result<()> {
loop {
// Wait up to 5s for another event
if poll(Duration::from_millis(5_000))? {

View File

@ -5,10 +5,10 @@ use crossterm::execute;
use {
crossterm::{
event::{poll, Event, KeyCode, KeyEvent},
terminal, Result,
terminal,
},
std::{
io::{stdout, Write},
io::{stdout, Result, Write},
time::Duration,
},
};

View File

@ -1,16 +1,12 @@
use {
crossterm::Result,
reedline::{
use reedline::{
get_reedline_default_keybindings, get_reedline_edit_commands,
get_reedline_keybinding_modifiers, get_reedline_keycodes, get_reedline_prompt_edit_modes,
get_reedline_reedline_events,
},
};
fn main() -> Result<()> {
fn main() {
get_all_keybinding_info();
println!();
Ok(())
}
/// List all keybinding information

View File

@ -36,9 +36,11 @@ use {
cursor::{SetCursorStyle, Show},
event,
event::{Event, KeyCode, KeyEvent, KeyModifiers},
terminal, QueueableCommand, Result,
terminal, QueueableCommand,
},
std::{
fs::File, io, io::Result, io::Write, process::Command, time::Duration, time::SystemTime,
},
std::{fs::File, io, io::Write, process::Command, time::Duration, time::SystemTime},
};
// The POLL_WAIT is used to specify for how long the POLL should wait for

View File

@ -11,9 +11,9 @@ use {
cursor::{self, MoveTo, RestorePosition, SavePosition},
style::{Attribute, Print, ResetColor, SetAttribute, SetForegroundColor},
terminal::{self, Clear, ClearType},
QueueableCommand, Result,
QueueableCommand,
},
std::io::Write,
std::io::{Result, Write},
};
#[cfg(feature = "external_printer")]
use {crate::LineBuffer, crossterm::cursor::MoveUp};