AnalogTerm2: Add -U to convert screen output to uppercase.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 18 Apr 2023 02:26:36 +0000 (02:26 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 18 Apr 2023 02:26:36 +0000 (02:26 +0000)
mmsoftware/analogterm2/src/config.c
mmsoftware/analogterm2/src/config.h
mmsoftware/analogterm2/src/draw.c
mmsoftware/analogterm2/src/main.c

index db5fdb4..fbb3247 100644 (file)
@@ -44,6 +44,7 @@ bool  cfg_slowscroll;
 int    cfg_jumpscrolllines;
 int    cfg_leading;
 int    cfg_inputsleep, cfg_inputsleepskip;
+bool   cfg_uppercaseview;
 
 
 void
@@ -84,6 +85,8 @@ cfg_setdefaults(void)
 
        cfg_inputsleep = INPUT_SLEEP;
        cfg_inputsleepskip = INPUT_SLEEP_SKIP;
+
+       cfg_uppercaseview = UPPERCASE_VIEW;
 }
 
 int 
index 9eb5c4b..507ccab 100644 (file)
@@ -279,6 +279,15 @@ extern int cfg_inputsleepskip;
 
 
 /*
+ * When this is enabled, input, video memory, copy and pasting are not
+ * affected, but the video display forces lowercase characters to uppercase.
+ */
+#define UPPERCASE_VIEW         false
+
+extern bool cfg_uppercaseview;
+
+
+/*
  * The XShm extention allows to accelerate graphics when the client is running
  * on the same system as the X11 server.
  */
index 385ee75..9b20b50 100644 (file)
@@ -318,11 +318,14 @@ draw_lines(state_t *st, screen_t *sc, int low, int high)
                 * sequence, prefill a line array with mode/glyph.
                 */
                for (col = 0; col < cfg_text_width; col++) {
-                       uint32_t m = st->text_mode[row][col];
+                       uint32_t m = st->text_mode[row][col],
+                                c = st->text_char[row][col];
 
+                       if (cfg_uppercaseview && c > 96 && c < 123)
+                               c -= 32;
                        row_modes[col] = m;
-                       row_glyphs[col] = font_glyph(st,
-                           st->text_char[row][col], (m & TMODE_GFX) != 0);
+                       row_glyphs[col] = font_glyph(st, c,
+                           (m & TMODE_GFX) != 0);
 
                        /* XOR text cursor handling */
                        if (!st->cursor_disabled && st->cursor_y == row &&
index 41e7564..e7f885c 100644 (file)
@@ -178,7 +178,7 @@ usage(void)
            "\nUsage: %s [-8|-u] [-w <cols>] [-h <rows>] [-E <n>] [-s]\n"
            "    [-C <color>] [-c] [-W] [-b] [-r <ms>] [-B <ticks>] [-j <n>]\n"
            "    [-P] [-m <mode>] [-M] [-d] [-D] [-S] [-p <parameters>]\n"
-           "    [-l <pixels>] [-f <delay>] [-z <ms>] [-Z <skip>] \n"
+           "    [-l <pixels>] [-f <delay>] [-U] [-z <ms>] [-Z <skip>]\n"
            "    [-e <command> [<arguments>]]\n\n"
            "Where:\n"
            " -8 / -u - 8-bit mode (Latin-1), unicode+UTF-8.  8-bit mode is\n"
@@ -224,6 +224,11 @@ usage(void)
            " -f - Number of frames to keep reverse video on for the flash\n"
            "      of the visual bell.  May not be visible with very low\n"
            "      values.  Also depends on -r.\n"
+           " -U - Does not affect input/output, copy-paste or video memory\n"
+           "      but forces the display to uppercase viewed characters.\n"
+           "      While this function could eventually be more complete,\n"
+           "      it only currently works with ASCII characters.\n"
+           "      May be problematic with case-sensitive data like files.\n"
            " -z - Slow bandwidth/bps simulation.  Sleep the specified\n"
            "      number of milliseconds before reading each byte from the\n"
            "      application tty(4).  Will also affect the rate of input\n"
@@ -278,7 +283,7 @@ main(int argc, char **argv, char **envp)
 
        progname = strdup(argv[0]);
        while ((ch = getopt(argc, argv,
-           "?8uw:h:E:scC:Wr:bB:j:Pm:MdDSp:l:f:z:Z:e:")) != -1) {
+           "?8uw:h:E:scC:Wr:bB:j:Pm:MdDSp:l:f:Uz:Z:e:")) != -1) {
                switch (ch) {
                case '8':
                        cfg_unicode = false;
@@ -371,6 +376,9 @@ main(int argc, char **argv, char **envp)
                        if ((i = atoi(optarg)) >= 0 && i <= 100)
                                cfg_flashtime = i;
                        break;
+               case 'U':
+                       cfg_uppercaseview = true;
+                       break;
                case 'z':
                        if ((i = atoi(optarg)) > -1 && i <= 100000)
                                cfg_inputsleep = i;