Skip to content

Commit

Permalink
chore: bump ratatui to 0.27 (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun authored Jun 28, 2024
1 parent aaed917 commit 678bce1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion component/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ lazy_static = "1.4.0"
libc = "0.2.148"
log = "0.4.20"
pretty_assertions = "1.4.0"
ratatui = { version = "0.26.0", features = ["serde", "macros"] }
ratatui = { version = "0.27.0", features = ["serde", "macros"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
signal-hook = "0.3.17"
Expand Down
2 changes: 1 addition & 1 deletion simple-async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ edition = "2021"
[dependencies]
crossterm = { version = "0.27.0", features = ["event-stream"] }
futures = "0.3.30"
ratatui = "0.26.0"
ratatui = "0.27.0"
tokio = { version = "1.35.1", features = ["full"] }
3 changes: 1 addition & 2 deletions simple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ license = "MIT"
edition = "2021"

[dependencies]
crossterm = "0.27.0"
ratatui = "0.26.0"
ratatui = "0.27.0"
4 changes: 3 additions & 1 deletion simple/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::app::AppResult;
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent};
use ratatui::crossterm::event::{
self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent,
};
use std::sync::mpsc;
use std::thread;
use std::time::{Duration, Instant};
Expand Down
2 changes: 1 addition & 1 deletion simple/src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::app::{App, AppResult};
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};

/// Handles the key events and updates the state of [`App`].
pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
Expand Down
8 changes: 4 additions & 4 deletions simple/src/tui.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::app::{App, AppResult};
use crate::event::EventHandler;
use crate::ui;
use crossterm::event::{DisableMouseCapture, EnableMouseCapture};
use crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen};
use ratatui::backend::Backend;
use ratatui::crossterm::event::{DisableMouseCapture, EnableMouseCapture};
use ratatui::crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen};
use ratatui::Terminal;
use std::io;
use std::panic;
Expand Down Expand Up @@ -31,7 +31,7 @@ impl<B: Backend> Tui<B> {
/// It enables the raw mode and sets terminal properties.
pub fn init(&mut self) -> AppResult<()> {
terminal::enable_raw_mode()?;
crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?;
ratatui::crossterm::execute!(io::stderr(), EnterAlternateScreen, EnableMouseCapture)?;

// Define a custom panic hook to reset the terminal properties.
// This way, you won't have your terminal messed up if an unexpected error happens.
Expand Down Expand Up @@ -61,7 +61,7 @@ impl<B: Backend> Tui<B> {
/// the terminal properties if unexpected errors occur.
fn reset() -> AppResult<()> {
terminal::disable_raw_mode()?;
crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?;
ratatui::crossterm::execute!(io::stderr(), LeaveAlternateScreen, DisableMouseCapture)?;
Ok(())
}

Expand Down

0 comments on commit 678bce1

Please sign in to comment.