From 9a6954f9720784bc79668bcc6456f6a3f6a0c5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Fri, 12 Sep 2025 22:33:39 -0700 Subject: Made it so pressing escape twice sends an escape to the IM, fixed the status line persisting even on exit. Refactored main process exit --- escape.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'escape.h') 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; -- cgit v1.1