mirror of
https://github.com/talwat/lowfi
synced 2025-01-14 04:11:27 +00:00
feat: handle ctrl+c
This commit is contained in:
parent
4ee86ec4f2
commit
672b0c5c98
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -982,7 +982,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lowfi"
|
name = "lowfi"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lowfi"
|
name = "lowfi"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "An extremely simple lofi player."
|
description = "An extremely simple lofi player."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -7,7 +7,7 @@ use crate::tracks::TrackInfo;
|
|||||||
use super::Player;
|
use super::Player;
|
||||||
use crossterm::{
|
use crossterm::{
|
||||||
cursor::{Hide, MoveToColumn, MoveUp, Show},
|
cursor::{Hide, MoveToColumn, MoveUp, Show},
|
||||||
event,
|
event::{self, KeyCode, KeyModifiers},
|
||||||
style::{Print, Stylize},
|
style::{Print, Stylize},
|
||||||
terminal::{self, Clear, ClearType},
|
terminal::{self, Clear, ClearType},
|
||||||
};
|
};
|
||||||
@ -143,11 +143,17 @@ pub async fn start(queue: Arc<Player>, sender: Sender<Messages>) -> eyre::Result
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let event::KeyCode::Char(code) = event.code else {
|
let KeyCode::Char(code) = event.code else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
match code {
|
match code {
|
||||||
|
'c' => {
|
||||||
|
// Handles Ctrl+C.
|
||||||
|
if event.modifiers == KeyModifiers::CONTROL {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
'q' => {
|
'q' => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user