[O] Allow ^c or esc to exit

This commit is contained in:
Azalea Gui
2023-03-08 19:58:02 -05:00
parent 2d641c89a3
commit 68e8319ec3
+3 -2
View File
@@ -400,7 +400,8 @@ async fn pull_input(mt: Arc<Mutex<Mutes>>, cn: &Consts) -> Result<()> {
// Switch on the key
match str.as_str() {
"q" => {
// exit on q or ctrl+c or esc
"q" | "\x03" | "\x1b" => {
mt.should_exit = true;
break;
},
@@ -445,7 +446,7 @@ fn run() -> Result<()> {
out.suspend_raw_mode().unwrap();
out.write(SHOW_CURSOR.as_ref())?;
out.write(CLEAR.as_ref())?;
out.write("Exiting...".as_ref())?;
out.write("\r\nThanks for visiting <3\n".as_ref())?;
out.flush()?;
Ok(())