summaryrefslogtreecommitdiff
path: root/escape.h
diff options
context:
space:
mode:
authorHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-12 22:33:39 -0700
committerHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-12 22:33:39 -0700
commit9a6954f9720784bc79668bcc6456f6a3f6a0c5a1 (patch)
treec605b3dab85848841a779bc8b0f864d67464ab6f /escape.h
parent9f80defcd51d2c429de55e1209dfa8f6fd22bc69 (diff)
Made it so pressing escape twice sends an escape to the IM, fixed the status
line persisting even on exit. Refactored main process exit
Diffstat (limited to 'escape.h')
-rw-r--r--escape.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/escape.h b/escape.h
index 8b5f0dd..d7c54a4 100644
--- a/escape.h
+++ b/escape.h
@@ -31,6 +31,8 @@ enum esc_state {
DECSC,
DECRC,
NORMAL,
+ //escape followed by an escape, has to be user generated
+ DOUBLE_ESC,
};
//global stdin -> pty ESC state
enum esc_state in_state = NORMAL;
@@ -54,6 +56,7 @@ enum esc_state update_esc_state(char * buff,unsigned int buff_len, enum esc_stat
case C1:
case DECSC:
case DECRC:
+ case DOUBLE_ESC:
//all the sequences that have ended don't have an end
//and default to normal
case NORMAL:
@@ -91,8 +94,12 @@ enum esc_state update_esc_state(char * buff,unsigned int buff_len, enum esc_stat
}
else if (c == '8') {
state = DECSC;
+ }
+ else if (c == 0x1B) {
+ state = DOUBLE_ESC;
//deformed escape sequence
- } else {
+ }
+ else {
state = NORMAL;
}
break;