From 68e8319ec3bf0caafac245f7ca04045df4f0e801 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Wed, 8 Mar 2023 19:58:02 -0500 Subject: [PATCH] [O] Allow ^c or esc to exit --- tngame-rs/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tngame-rs/src/main.rs b/tngame-rs/src/main.rs index ecf14e3..fe0b65f 100644 --- a/tngame-rs/src/main.rs +++ b/tngame-rs/src/main.rs @@ -400,7 +400,8 @@ async fn pull_input(mt: Arc>, 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(())