mirror of
https://github.com/figsoda/mmtc
synced 2024-11-22 07:03:05 +00:00
allow scrolling with mouse
This commit is contained in:
parent
d5cd92ae3a
commit
1aedeb45c3
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
@ -8,7 +8,7 @@ mod mpd;
|
|||
|
||||
use anyhow::{Context, Error, Result};
|
||||
use crossterm::{
|
||||
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent},
|
||||
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, MouseEvent},
|
||||
execute,
|
||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
};
|
||||
|
@ -149,7 +149,15 @@ async fn run() -> Result<()> {
|
|||
}
|
||||
_ => (),
|
||||
},
|
||||
Event::Resize(..) => tx.send(Command::UpdateFrame).await.unwrap_or_else(die),
|
||||
Event::Mouse(MouseEvent::ScrollDown(..)) => {
|
||||
tx.send(Command::Down).await.unwrap_or_else(die);
|
||||
}
|
||||
Event::Mouse(MouseEvent::ScrollUp(..)) => {
|
||||
tx.send(Command::Up).await.unwrap_or_else(die);
|
||||
}
|
||||
Event::Resize(..) => {
|
||||
tx.send(Command::UpdateFrame).await.unwrap_or_else(die);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue