Skip to content

Commit

Permalink
Bump crossterm to 0.27.0 (#625)
Browse files Browse the repository at this point in the history
* Bump `crossterm` to 0.27.0

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

* Cargo fmt

* Fix examples
  • Loading branch information
sholderbach authored Aug 28, 2023
1 parent 6143b01 commit 31257a4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
9 changes: 6 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use {
crossterm::{
cursor::SetCursorStyle,
event::{DisableBracketedPaste, KeyCode, KeyModifiers},
execute, Result,
execute,
},
nu_ansi_term::{Color, Style},
reedline::{
Expand All @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions examples/event_listener.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
use {
crossterm::{
event::{poll, Event, KeyCode, KeyEvent},
terminal, Result,
terminal,
},
std::{
io::{stdout, Write},
time::Duration,
},
};

fn main() -> Result<()> {
fn main() -> std::io::Result<()> {
println!("Ready to print events (Abort with ESC):");
print_events()?;
println!();
Ok(())
}

/// **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();
Expand All @@ -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))? {
Expand Down
4 changes: 2 additions & 2 deletions examples/event_listener_kitty_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
Expand Down
14 changes: 5 additions & 9 deletions examples/list_bindings.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
use {
crossterm::Result,
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,
},
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
Expand Down
6 changes: 4 additions & 2 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/painting/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 31257a4

Please sign in to comment.