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