When rendering messages in the old text client format, identify pull quotes and rende...
authorArt Cancro <ajc@citadel.org>
Wed, 21 Sep 2022 22:25:48 +0000 (18:25 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 21 Sep 2022 22:25:48 +0000 (18:25 -0400)
textclient/commands.c

index 880d3ebc08139eb20e366683073d66ad63856cd1..197fe1a9d58dca65c9759838b33bac880fbdb766 100644 (file)
@@ -1406,6 +1406,7 @@ int fmout(int width,              // screen width to use
        char old = 0;           // The previous character
        int column = 0;         // Current column
        size_t i;               // Generic counter
+       int in_quote = 0;
 
        // Space for a single word, which can be at most screenwidth
        word = (char *) calloc(1, width);
@@ -1429,11 +1430,18 @@ int fmout(int width,            // screen width to use
 
        // Run the message body
        while (*e) {
+
                // Catch characters that shouldn't be there at all
                if (*e == '\r') {
                        e++;
                        continue;
                }
+
+               if ( (in_quote) && (*e == '\n') && (enable_color) ) {
+                       in_quote = 0;
+                       scr_printf("\033[22m\033[23m");
+               }
+
                if (*e == '\n') {       // newline?
                        e++;
                        if (*e == ' ') {        // paragraph?
@@ -1458,6 +1466,11 @@ int fmout(int width,             // screen width to use
                        continue;
                }
 
+               if ( (*e == '>') && (column <= 1) && (!fpout) && (enable_color) ) {
+                       in_quote = 1;
+                       scr_printf("\033[2m\033[3m");
+               }
+
                // Or are we looking at a space?
                if (*e == ' ') {
                        e++;