AnalogTerm2:
authorMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 28 Mar 2023 03:31:38 +0000 (03:31 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 28 Mar 2023 03:31:38 +0000 (03:31 +0000)
- Implement CVVIS (very visible cursor mode)
- Allow to enforce very visible cursor mode with -M
- Prevent enabling blinking if user enforces non-blinking
- Add a few new screenshots displaying alternative fonts
- Improve the Square font

mmsoftware/analogterm2/TODO.txt
mmsoftware/analogterm2/screenshots/analogterm2-green-customsettings-square-font.png [new file with mode: 0644]
mmsoftware/analogterm2/screenshots/analogterm2-ocr-font.png [new file with mode: 0644]
mmsoftware/analogterm2/src/config.c
mmsoftware/analogterm2/src/config.h
mmsoftware/analogterm2/src/draw.c
mmsoftware/analogterm2/src/main.c
mmsoftware/analogterm2/src/state.c
mmsoftware/analogterm2/src/state.h
mmsoftware/analogterm2/tests/square-font.txt

index 00c7471..638850b 100644 (file)
@@ -1,4 +1,3 @@
-- Investigate why tests/font-add.sh doesn't always work.
 - 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.
diff --git a/mmsoftware/analogterm2/screenshots/analogterm2-green-customsettings-square-font.png b/mmsoftware/analogterm2/screenshots/analogterm2-green-customsettings-square-font.png
new file mode 100644 (file)
index 0000000..575c298
Binary files /dev/null and b/mmsoftware/analogterm2/screenshots/analogterm2-green-customsettings-square-font.png differ
diff --git a/mmsoftware/analogterm2/screenshots/analogterm2-ocr-font.png b/mmsoftware/analogterm2/screenshots/analogterm2-ocr-font.png
new file mode 100644 (file)
index 0000000..b18653c
Binary files /dev/null and b/mmsoftware/analogterm2/screenshots/analogterm2-ocr-font.png differ
index 6c26c90..095e177 100644 (file)
@@ -29,7 +29,8 @@ static const struct eparam_s eparams[] = {
 int    cfg_color, cfg_monocolor;
 bool   cfg_mono;
 int    cfg_refreshspeed, cfg_blinkspeed, cfg_cursormode;
-bool   cfg_cursorblink, cfg_cursordisable, cfg_cursorprintreset;
+bool   cfg_cursorblink, cfg_cursordisable, cfg_cursorbright,
+       cfg_cursorprintreset;
 int    cfg_intmin, cfg_intstep, cfg_intfg, cfg_intscan, cfg_intbg;
 double cfg_intfgf, cfg_intscanf, cfg_intbgf;
 int    cfg_text_width, cfg_text_height;
@@ -54,6 +55,7 @@ cfg_setdefaults(void)
        cfg_blinkspeed = BLINK_SPEED;
        cfg_cursormode = CURSOR_MODE;
        cfg_cursorblink = CURSOR_BLINK;
+       cfg_cursorbright = CURSOR_BRIGHT;
        cfg_cursordisable = CURSOR_DISABLE;
        cfg_cursorprintreset = CURSOR_PRINTRESET;
 
index ddcf395..d21dec3 100644 (file)
@@ -77,6 +77,12 @@ extern int cfg_cursormode;
 
 extern bool cfg_cursorblink;
 
+/* Very visible cursor */
+
+#define CURSOR_BRIGHT          false
+
+extern bool cfg_cursorbright;
+
 
 /*
  * Allow the cursor to be turned off with DEC Private Mode sequence 25.
index b0f1b36..06c8b37 100644 (file)
@@ -421,7 +421,11 @@ draw_lines(state_t *st, screen_t *sc, int low, int high)
                     (st->cursor_mode == CMODE_LINE &&
                      grow >= (FONT_HEIGHT - 2)) ||
                     (st->cursor_mode == CMODE_BAR && bit < 2))) {
-                       color = st->monocolor;
+                       if (st->cursor_bright) {
+                               intensity = INTENSITY_MAX;
+                               fgcolor = color = COLOR_WHITE;
+                       } else
+                               color = st->monocolor;
                        if ((m & (TMODE_INVERSE | TMODE_BGCOLOR)) != 0)
                                p = (p == 0 ? INTENSITY_DIM :
                                    INTENSITY_DIM / 2);
index a756eae..7904456 100644 (file)
@@ -170,7 +170,7 @@ usage(void)
        fprintf(stderr,
            "\nUsage: %s [-8|-u] [-w <cols>] [-h <rows>] [-E <n>] [-s]\n"
            "    [-C <color>] [-c] [-W] [-b] [-B <microseconds>] [-P]\n"
-           "    [-m <mode>] [-d] [-D] [-S] [-p <parameters>]\n"
+           "    [-m <mode>] [-M] [-d] [-D] [-S] [-p <parameters>]\n"
            "    [-e <command> [<arguments>]]\n\n"
            "Where:\n"
            " -8 / -u - 8-bit mode (Latin-1), unicode+UTF-8.  8-bit mode is\n"
@@ -194,6 +194,7 @@ usage(void)
            "      This can also be changed with ESC [?658467;65538;<n>h\n"
            " -P - If the cursor is blinking, reset its timer for printing.\n"
            " -m - Set default cursor style (0 = block, 1 = line, 2 = bar).\n"
+           " -M - Enable very visible cursor mode by default.\n"
            " -d - Log emulator debug messages to stderr.\n"
            " -D - Toggle if the cursor can be disabled or not.\n"
            " -S - Wait in a sleeping loop until the user closes the window\n"
@@ -243,7 +244,7 @@ main(int argc, char **argv, char **envp)
        cfg_unicode = !locale_8bit();
 
        progname = strdup(argv[0]);
-       while ((ch = getopt(argc, argv, "?8uw:h:E:scC:Wr:bB:Pm:dDSp:e:"))
+       while ((ch = getopt(argc, argv, "?8uw:h:E:scC:Wr:bB:Pm:MdDSp:e:"))
            != -1) {
                switch (ch) {
                case '8':
@@ -310,6 +311,9 @@ main(int argc, char **argv, char **envp)
                        if ((i = atoi(optarg)) > -1 && i < 3)
                                cfg_cursormode = i;
                        break;
+               case 'M':
+                       cfg_cursorbright = !cfg_cursorbright;
+                       break;
                case 'd':
                        cfg_stderr = true;
                        break;
index e12c5d2..a5bdc62 100644 (file)
@@ -220,6 +220,7 @@ state_reset(state_t *st)
        st->cursor_mode = cfg_cursormode;
        st->cursor_blink = cfg_cursorblink;
        st->cursor_disabled = false;
+       st->cursor_bright = cfg_cursorbright;
        st->quotedpaste = false;
        st->monocolor = cfg_color;
        st->mode = 0;
@@ -963,8 +964,10 @@ state_emul_printc(state_t *st, uint8_t c)
                                        if (state->csiparam[i] == 13)
                                                st->cursor_blink = true;
                                        break;
-                               case 25: /* Show cursor (DECTCEM) */
+                               case 25: /* Show cursor (DECTCEM, cvvis) */
+                                       /* XXX "Very visible" vs cnorm */
                                        st->cursor_disabled = false;
+                                       st->cursor_bright = true;
                                        break;
                                case 2004: /* Bracketed paste mode */
                                        st->quotedpaste = true;
@@ -1134,6 +1137,10 @@ endh:
                                case 4: /* Fast/jump scroll (DECSCLM) */
                                        st->scroll_slow = false;  
                                        break;
+                               case 6:
+                                       /* Normal cursor mode (DECOM cnorm) */
+                                       
+                                       break;
                                case 12:
                                case 13: /* FALLTHROUGH
                                          * Stop blinking cursor.
@@ -1144,7 +1151,7 @@ endh:
                                        if (state->csiparam[i] == 13)
                                                st->cursor_blink = false;
                                        break;
-                               case 25: /* Hide cursor (DECTCEM) */
+                               case 25: /* Hide cursor (DECTCEM, civis) */
                                        if (cfg_cursordisable)
                                                st->cursor_disabled = true;
                                        break;
@@ -1440,10 +1447,12 @@ endh:
                                        /* User-configured as default */
                                        st->cursor_mode = cfg_cursormode;
                                        st->cursor_blink = cfg_cursorblink;
+                                       st->cursor_bright = cfg_cursorbright;
                                        break;
                                case 1:
                                        st->cursor_mode = CMODE_BLOCK;
-                                       st->cursor_blink = true;
+                                       if (cfg_cursorblink)
+                                               st->cursor_blink = true;
                                        break;
                                case 2:
                                        st->cursor_mode = CMODE_BLOCK;
@@ -1451,7 +1460,8 @@ endh:
                                        break;
                                case 3:
                                        st->cursor_mode = CMODE_LINE;
-                                       st->cursor_blink = true;
+                                       if (cfg_cursorblink)
+                                               st->cursor_blink = true;
                                        break;
                                case 4:
                                        st->cursor_mode = CMODE_LINE;
@@ -1459,7 +1469,8 @@ endh:
                                        break;
                                case 5:
                                        st->cursor_mode = CMODE_BAR;
-                                       st->cursor_blink = true;
+                                       if (cfg_cursorblink)
+                                               st->cursor_blink = true;
                                        break;
                                case 6:
                                        st->cursor_mode = CMODE_BAR;
index 38d4c9e..04e2028 100644 (file)
@@ -51,7 +51,7 @@ struct state_s {
        bool *text_updated;                     /* For screen updates */
        bool text_updateall;
        bool blink_update;
-       bool cursor_blink, cursor_disabled;
+       bool cursor_blink, cursor_disabled, cursor_bright;
        bool quotedpaste;
        int monocolor;
        int cursor_mode, cursor_x, cursor_y;
index 0f5d465..830af4e 100644 (file)
@@ -61,9 +61,9 @@
 .......
 .OO....
 .OO..O.
-.....O.
-.OOOOO.
-.O.....
+....O..
+...O...
+..O....
 .O..OO.
 ....OO.
 .......
 .......
 .......
 .......
-...O...
+.......
 ...O...
 ..O....
 .......
 
 52
 .......
-.O..O..
+.O.....
 .O..O..
 .O..O..
 .O..O..
 .......
 ...O...
 .......
-...O...
+.......
 ...O...
 ..O....
 .......
 .......
 .OOOOO.
 .O...O.
-...OOO.
+....O..
 ...O...
 ...O...
 .......
 
 91
 .......
-.OOOO..
-.O.....
-.O.....
-.O.....
-.O.....
-.O.....
-.OOOO..
+..OOO..
+..O....
+..O....
+..O....
+..O....
+..O....
+..OOO..
 .......
 
 92
 
 93
 .......
-..OOOO.
-.....O.
-.....O.
-.....O.
-.....O.
-.....O.
-..OOOO.
+..OOO..
+....O..
+....O..
+....O..
+....O..
+....O..
+..OOO..
 .......
 
 94