Skip to content

Commit

Permalink
Update crossterm requirement from 0.12 to 0.27 (#30)
Browse files Browse the repository at this point in the history
Updates the requirements on [crossterm](https://github.com/crossterm-rs/crossterm) to permit the latest version.
- [Release notes](https://github.com/crossterm-rs/crossterm/releases)
- [Changelog](https://github.com/crossterm-rs/crossterm/blob/master/CHANGELOG.md)
- [Commits](crossterm-rs/crossterm@0.12.0...0.27.0)

---
updated-dependencies:
- dependency-name: crossterm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Nov 27, 2023
1 parent 430b408 commit b390f38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion interactive-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ publish = false

[dependencies]
anes = { path = "../anes" }
crossterm = "0.12"
crossterm = "0.27"
23 changes: 16 additions & 7 deletions interactive-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::io::{self, Write};

use anes::{execute, queue};

pub use crossterm::Result;
use crossterm::{
event::{self, Event, KeyCode, KeyEvent},
terminal::enable_raw_mode,
};
use std::io::{self, Result, Write};

#[macro_use]
mod macros;
Expand Down Expand Up @@ -30,7 +31,7 @@ where
{
execute!(w, anes::SwitchBufferToAlternate)?;

let _raw = crossterm::RawScreen::into_raw_mode()?;
enable_raw_mode()?;

loop {
queue!(
Expand Down Expand Up @@ -64,11 +65,19 @@ where
}

pub fn read_char() -> Result<char> {
crossterm::input().read_char()
loop {
if let Event::Key(KeyEvent {
code: KeyCode::Char(c),
..
}) = event::read()?
{
return Ok(c);
}
}
}

pub fn buffer_size() -> Result<(u16, u16)> {
crossterm::terminal().size()
crossterm::terminal::size()
}

fn main() -> Result<()> {
Expand Down

0 comments on commit b390f38

Please sign in to comment.