From 8c0cafc4fa850ad2d7a3c2624477bc1b148d995e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 21 Sep 2022 18:25:48 -0400 Subject: [PATCH] When rendering messages in the old text client format, identify pull quotes and render them in dimmer video and italic font (if supported by the terminal). --- textclient/commands.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/textclient/commands.c b/textclient/commands.c index 880d3ebc0..197fe1a9d 100644 --- a/textclient/commands.c +++ b/textclient/commands.c @@ -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++; -- 2.39.2