AnalogTerm2: Remember blink speed setting per VT520 cursor type.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 7 May 2023 01:29:10 +0000 (01:29 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 7 May 2023 01:29:10 +0000 (01:29 +0000)
mmsoftware/analogterm2/TODO.txt
mmsoftware/analogterm2/src/draw.c
mmsoftware/analogterm2/src/state.c
mmsoftware/analogterm2/src/state.h

index 4dbb1ed..3756ec9 100644 (file)
   Now it is possible by using -e /bin/sh -c.
 - Now that glyphs can be modified it is obviously a suboptimal method.
   General font loading could work, it may be worth checking older standard
-  practice for reference and ideas.
+  practice for reference and ideas.  Also, we may want to optimize the memory
+  layout for fast lookup, somewhat like is done with the native font, where
+  contiguous blocks are kept together, in case we decide to start blank and
+  load a font at startup.
 - Eventually provide a way to query terminal specific settings that can be
   altered using sequences and develop a live configuration utility that can
   also store settings.
 - The custom ATC sequences code is messy especially because of the
-  indentation.  Eventually cleanup.
-- Now that blinking speed can be configured via a special ATC sequence,
-  and that VT520 cursor style change sequence is also supported, it would be
-  possible to remember the speed for each cursor type.  There seems to be no
-  standard handling to respect except to observe requests to blink or not.
-  This would allow applications like neovim using this VT520 feature to
-  produce a faster blinking underline and bar cursor and a slower blinking
-  block cursor.
+  indentation.  Eventually cleanup.  It probably should really be moved out of
+  the DEC Special sequences and we may want to give names to number commands.
 - On RPI when omxplayer is launched directly from analogterm2 and bash, it
   does not behave exactly like under xterm or urxvt: keys sent to omxplayer
   may either still be sent to analogterm2 or the terminal may be in another
@@ -35,7 +32,7 @@
   https://en.wikipedia.org/wiki/Box-drawing_character
 - Overwrite/clear selections before freeing them
 - ≣ † ☆ ツ ⌘›🍺∴ ( ͡° ͜ʖ ͡°)   ƒ   ︵  ₂   😈  θ  ƒ  ›  ʼ  ƒ ∂  ʻ  μ  ›  ∫   ◇ ♪
-  ► ə β ə ſ ρ ə ∴ ♪ 😱 † 😳 › ▛ ᵗ * ‽ ℣
+  ► ə β ə ſ ρ ə ∴ ♪ 😱 † 😳 › ▛ ᵗ * ‽ ℣ Ω 
 - Verify if dead key support is incomplete for ISO-8859-4 and ISO-8859-10.
   There were special characters that were unicode since the start but also
   could have punctuation.  And others that used two at a time...  It might
@@ -95,7 +92,8 @@
   from the X11 window/user and from applications, but we don't really want the
   user to have to type those.  Another idea may be a signature CSI parameter
   but that too is inconvenient for users without a tool.
-- Maybe support a configuration menu, possibly using curses.
+- Maybe support a configuration menu, possibly using curses.  It could be
+  embedded or a separate tool using special sequences.
 - Alt/Meta now sends ESC, but it's unsure yet if that will work properly
   on most systems.  The old XScreenSaver based AnalogTerm code was more
   complex to detect what keys were meta using X11 mapping functions.
   - Full screen refresh
   - We should probably avoid reallocating everything while the window is being
     resized and thus perhaps disable refresh during resize until it's done...
-- Optional multicolor (7/14) support.
-- Will be interesting to work on decent text cursors.
+- Optional half-bright in color mode (14 vs 7) support.
+- Perhaps allow more configurable cursors, like some based on custom shapes,
+  glyphs or not using XOR.  Underline/bar/block are supported already.
 - C cedilla characters look strange.  These could be improved if the font was
   eventually one pixel wider vertically.
 - Maybe detect and record ourselves shift/ctrl to avoid using the
   key mappings that present themselves with shift/ctrl always
   pressed.
 - Maybe eventual support for a completely retro-like vector custom font.
-- Perhaps consider xvideo hardware scaling support
 - 2.5 vertical zooming vs 2, an alternative to play with the character ratio.
 - Set ERASE.  If automatically detecting it from terminfo, there's the mess of
   using either BSD terminfo or ncurses', and on Linux systems the
   sets ERASE to ^?, it still issues ^H meaning that ERASE really must be ^H.
   This supposes that the terminal should also send the key that corresponds to
   the TERM entry.  Or that it should simply keep issuing ^H for the BackSpace
-  key, keep setting ^H for ERASE and it's solved.  Except perhaps with some
+  key, keep setting ^H for ERASE and it's solved.  Except with some
   particular applications that'd expect ^? or use the kbs entry, perhaps.
 - Perhaps reserve a status line at the top or bottom and use it for various
   state information, maybe even some optional effects.
   than vttest.
 - Maybe include ffmpeg recording as part of analogterm.  This would be easier
   of already supporting YUV internally for xvideo(4).
-- Maybe consider xvideo(4) zooming.  If YUV was native, it'd be useful for xvideo
-  and ffmpeg.
+- Maybe consider xvideo(4) zooming.  If YUV was native, it'd be useful for
+  xvideo and ffmpeg and custom ratios could be applied.
 - Maybe an alternative VT52 or ADM-3A emulation mode for use with old CP/M
   systems and emulators.
 - Maybe make a telnet+modem emulator mode.  This would be like telnet and
   modemu, interpreting some AT commands, or directly connected to a real modem
   as a terminal rather than for a shell...
+- Some unicode characters are double-width.  This is not currently supported.
+- Combining unicode characters are not supported.
index 5bbe191..233fcfe 100644 (file)
@@ -205,7 +205,9 @@ alarm_sighandler(int sig)
        }
 
        /* Modulate the blinking state */
-       blinkspeed = (draw_blink_state ? cfg_blinkspeedoff : cfg_blinkspeedon);
+       blinkspeed = (draw_blink_state ?
+           state->cursor_speed[state->cursor_mode][1] :
+           state->cursor_speed[state->cursor_mode][0]);
        if (++blink_ticks == blinkspeed) {
                blink_ticks = 0;
                draw_blink_state = !draw_blink_state;
index b72dcc3..459b6e4 100644 (file)
@@ -141,9 +141,15 @@ state_init(int pty)
        st->nselected = 0;
        st->pasting = None;
        state_reset(st);
-       st->blink_update = false;
        st->pty = pty;
 
+       /* Cursor */
+       st->blink_update = false;
+       for (y = 0; y < CMODE_MAX; y++) {
+               st->cursor_speed[y][0] = cfg_blinkspeedon;
+               st->cursor_speed[y][1] = cfg_blinkspeedoff;
+       }
+
        /* Emulator double state */
        estate.cursor_x = st->cursor_x;
        estate.cursor_y = st->cursor_y;
@@ -1163,9 +1169,11 @@ state_emul_printc(state_t *st, uint8_t c)
 
                                                /* Blinking speed */
                                                if (s1 > 0 && s1 < 501)
-                                                       cfg_blinkspeedon = s1;
+                                                       st->cursor_speed[st->cursor_mode][0]
+                                                          = s1;
                                                if (s2 > 0 && s2 < 501)
-                                                       cfg_blinkspeedoff = s2;
+                                                       st->cursor_speed[st->cursor_mode][1]
+                                                          = s2;
                                                draw_blink_reset();
                                                state_update_cursor(st);
                                        } else if (state->curparam == 3 &&
index 4525b31..a2573f7 100644 (file)
@@ -43,7 +43,8 @@ typedef struct state_s state_t;
 enum cursor_mode {
        CMODE_BLOCK = 0,
        CMODE_LINE = 1,
-       CMODE_BAR = 2
+       CMODE_BAR = 2,
+       CMODE_MAX
 };
 
 /* Text attributes */
@@ -84,6 +85,7 @@ struct state_s {
        int cursor_mode, cursor_x, cursor_y;
        int saved_cursor_x, saved_cursor_y;
        int cursor_disabled_ticks;
+       int cursor_speed[CMODE_MAX][2];
        uint32_t mode;
        int scroll_top, scroll_bottom;
        bool scroll_slow, scroll_smooth;