From 529a46ad415ad42d6e4a1ac1f85dd72a1993398c Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sun, 11 Oct 2020 17:58:35 +0200 Subject: degesch: add support for crossed-out text Assuming that sgr0 includes rmxx behaviour, which should be true. --- degesch.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/degesch.c b/degesch.c index 7e16205..92863da 100644 --- a/degesch.c +++ b/degesch.c @@ -2761,11 +2761,12 @@ init_colors (struct app_context *ctx) enum { - TEXT_BOLD = 1 << 0, - TEXT_ITALIC = 1 << 1, - TEXT_UNDERLINE = 1 << 2, - TEXT_INVERSE = 1 << 3, - TEXT_BLINK = 1 << 4 + TEXT_BOLD = 1 << 0, + TEXT_ITALIC = 1 << 1, + TEXT_UNDERLINE = 1 << 2, + TEXT_INVERSE = 1 << 3, + TEXT_BLINK = 1 << 4, + TEXT_CROSSED_OUT = 1 << 5 }; struct attr_printer @@ -2939,9 +2940,14 @@ attr_printer_apply (struct attr_printer *self, 0, // blank 0, // protect 0)); // acs - if (enter_italics_mode && (text_attrs & TEXT_ITALIC)) + if ((text_attrs & TEXT_ITALIC) && enter_italics_mode) attr_printer_tputs (self, enter_italics_mode); + char *smxx = NULL; + if ((text_attrs & TEXT_CROSSED_OUT) + && (smxx = tigetstr ("smxx")) && smxx != (char *) -1) + attr_printer_tputs (self, smxx); + if (fg >= 0) attr_printer_tputs (self, g_terminal.color_set_fg[fg]); if (bg >= 0) @@ -3199,10 +3205,12 @@ formatter_parse_mirc (struct formatter *self, const char *s) switch (c) { - case '\x02': FORMATTER_ADD_SIMPLE (self, BOLD); break; - case '\x1d': FORMATTER_ADD_SIMPLE (self, ITALIC); break; - case '\x1f': FORMATTER_ADD_SIMPLE (self, UNDERLINE); break; - case '\x16': FORMATTER_ADD_SIMPLE (self, INVERSE); break; + case '\x02': FORMATTER_ADD_SIMPLE (self, BOLD); break; + case '\x11': /* monospace, N/A */ break; + case '\x1d': FORMATTER_ADD_SIMPLE (self, ITALIC); break; + case '\x1e': FORMATTER_ADD_SIMPLE (self, CROSSED_OUT); break; + case '\x1f': FORMATTER_ADD_SIMPLE (self, UNDERLINE); break; + case '\x16': FORMATTER_ADD_SIMPLE (self, INVERSE); break; case '\x03': s = formatter_parse_mirc_color (self, s); @@ -13523,6 +13531,9 @@ process_mirc_escape (const struct pollfd *fd, struct app_context *ctx) case 'i' ^ 96: case 'i': case ']': CALL_ (ctx->input, insert, "\x1d"); break; + case 'x' ^ 96: + case 'x': + case '^': CALL_ (ctx->input, insert, "\x1e"); break; case 'u' ^ 96: case 'u': case '_': CALL_ (ctx->input, insert, "\x1f"); break; -- cgit v1.2.3-70-g09d2