:: commit 5ffce7c42ef294cc938eee158c369ba7eb1abd13

mintsuki <mintsuki@protonmail.com> — 2021-08-06 04:16

parents: 6275457af0

term: Support DEC private escape 25 (enable/disable cursor)

diff --git a/stage23/lib/term.s2.c b/stage23/lib/term.s2.c
index e42cc440..3fa809b4 100644
--- a/stage23/lib/term.s2.c
+++ b/stage23/lib/term.s2.c
@@ -73,10 +73,12 @@ void term_deinit(void) {
 
 static void term_putchar(uint8_t c);
 
+static bool old_cur_stat;
+
 void term_write(const char *buf, size_t count) {
     if (term_backend == NOT_READY)
         return;
-    bool old_cur_stat = disable_cursor();
+    old_cur_stat = disable_cursor();
     for (size_t i = 0; i < count; i++)
         term_putchar(buf[i]);
     if (old_cur_stat)
@@ -150,8 +152,18 @@ def:
 }
 
 static void dec_private_parse(uint8_t c) {
-    (void)c;
     dec_private = false;
+
+    if (esc_values_i > 0) {
+        switch (esc_values[0]) {
+            case 25: {
+                switch (c) {
+                    case 'h': old_cur_stat = true; return;
+                    case 'l': old_cur_stat = false; return;
+                }
+            }
+        }
+    }
 }
 
 static void control_sequence_parse(uint8_t c) {
tab: 248 wrap: offon