generated from GarandPLG/rust-flake-template
Rename input event handler to handle_events
Rename the input event handler module and function. Update imports, re‑exports, and main.rs to use handle_events. Add a brief doc comment for the new function.
This commit is contained in:
@@ -2,7 +2,8 @@ use crate::app::threads::AppEvent;
|
||||
use ratatui::crossterm::event::{Event, read};
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
pub fn handle_input_events(tx: Sender<AppEvent>) {
|
||||
/// Reads *all* crossterm events and forwards the ones we care about.
|
||||
pub fn handle_events(tx: Sender<AppEvent>) {
|
||||
loop {
|
||||
match read() {
|
||||
Ok(ev) => match ev {
|
||||
@@ -11,8 +12,8 @@ pub fn handle_input_events(tx: Sender<AppEvent>) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Event::Resize(c, r) => {
|
||||
if tx.send(AppEvent::Resize(c, r)).is_err() {
|
||||
Event::Resize(cols, rows) => {
|
||||
if tx.send(AppEvent::Resize(cols, rows)).is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
pub mod events;
|
||||
pub mod handle_input_events;
|
||||
pub mod handle_events;
|
||||
|
||||
pub use events::AppEvent;
|
||||
pub use handle_input_events::handle_input_events;
|
||||
pub use handle_events::handle_events;
|
||||
|
||||
Reference in New Issue
Block a user