diff options
author | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-13 01:13:25 -0700 |
---|---|---|
committer | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-13 01:13:25 -0700 |
commit | 837b4d765a259bbdcb4b9c28bc6b1c5eb1548292 (patch) | |
tree | 4b3eff6f39c4e06417ec8c3032cfd6109ee2860b /escape.h | |
parent | feefde22da62a12901ac011d5d34c6567411d6b2 (diff) |
Added safe state function
Diffstat (limited to 'escape.h')
-rw-r--r-- | escape.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -34,6 +34,27 @@ enum esc_state { //escape followed by an escape, has to be user generated DOUBLE_ESC, }; + +//returns 1 if the current state is safe to insert characters after, 0 if not +int safe_state(enum esc_state state) { + swtich (state) { + case CSI_END: + case ST: + case nF_END: + case C0: + case C1: + case DECSC: + case DECRC: + case DOUBLE_ESC: + case NORMAL: + return 1; + break; + default: + return 0; + break; + } +} + //global stdin -> pty ESC state enum esc_state in_state = NORMAL; //global pty -> stdout ESC state |