AnalogTerm2: Add a special ATC sequence to configure text speed.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 9 May 2023 02:41:42 +0000 (02:41 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 9 May 2023 02:41:42 +0000 (02:41 +0000)
mmsoftware/analogterm2/src/main.c
mmsoftware/analogterm2/src/state.c

index f0984f7..fce5ab5 100644 (file)
@@ -284,6 +284,9 @@ usage(void)
            "      Useful to audit/optimize applications or as a fun effect.\n"
            "      Disabling jump scrolling will affect the behavior, see -r\n"
            "      and -j.  With -j1 a middle ground is possible.\n"
+           "      Can also be configured using the special escape sequence\n"
+           "      [?658467;65548;<n1>[;<n2>]h where <n1> is like -z and the\n"
+           "      optional <n2> is like -Z.\n"
            " -Z - If -z is enabled, specify the number of bytes to read\n"
            "      before sleeping.  Useful when the scheduler cannot sleep\n"
            "      for short enough delays.\n"
index 8635cf2..cb59bcb 100644 (file)
@@ -1248,6 +1248,21 @@ state_emul_printc(state_t *st, uint8_t c)
                                                        st->text_blink_speed_off
                                                            = s2;
                                                draw_blink_reset();
+                                       } else if ((state->curparam == 2 ||
+                                                   state->curparam == 3) &&
+                                                  state->csiparam[1] ==
+                                                  65548) {
+                                               int s1 = state->csiparam[2],
+                                                   s2 = (state->curparam == 3
+                                                         ? state->csiparam[3]
+                                                         : 0);
+
+                                               /* Text input speed */
+                                               if (s1 > -1 && s1 <= 100000)
+                                                       cfg_inputsleep = s1;
+                                               if (s2 > -1 && s2 <= 256)
+                                                       cfg_inputsleepskip =
+                                                          s2;
                                        } else if (state->curparam == 3 &&
                                                   state->csiparam[1] ==
                                                   65539) {