degesch: add support for crossed-out text

Assuming that sgr0 includes rmxx behaviour, which should be true.
This commit is contained in:
Přemysl Eric Janouch 2020-10-11 17:58:35 +02:00
parent f9ef123171
commit 529a46ad41
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 21 additions and 10 deletions

View File

@ -2765,7 +2765,8 @@ enum
TEXT_ITALIC = 1 << 1, TEXT_ITALIC = 1 << 1,
TEXT_UNDERLINE = 1 << 2, TEXT_UNDERLINE = 1 << 2,
TEXT_INVERSE = 1 << 3, TEXT_INVERSE = 1 << 3,
TEXT_BLINK = 1 << 4 TEXT_BLINK = 1 << 4,
TEXT_CROSSED_OUT = 1 << 5
}; };
struct attr_printer struct attr_printer
@ -2939,9 +2940,14 @@ attr_printer_apply (struct attr_printer *self,
0, // blank 0, // blank
0, // protect 0, // protect
0)); // acs 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); 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) if (fg >= 0)
attr_printer_tputs (self, g_terminal.color_set_fg[fg]); attr_printer_tputs (self, g_terminal.color_set_fg[fg]);
if (bg >= 0) if (bg >= 0)
@ -3200,7 +3206,9 @@ formatter_parse_mirc (struct formatter *self, const char *s)
switch (c) switch (c)
{ {
case '\x02': FORMATTER_ADD_SIMPLE (self, BOLD); break; case '\x02': FORMATTER_ADD_SIMPLE (self, BOLD); break;
case '\x11': /* monospace, N/A */ break;
case '\x1d': FORMATTER_ADD_SIMPLE (self, ITALIC); 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 '\x1f': FORMATTER_ADD_SIMPLE (self, UNDERLINE); break;
case '\x16': FORMATTER_ADD_SIMPLE (self, INVERSE); break; case '\x16': FORMATTER_ADD_SIMPLE (self, INVERSE); break;
@ -13523,6 +13531,9 @@ process_mirc_escape (const struct pollfd *fd, struct app_context *ctx)
case 'i' ^ 96: case 'i' ^ 96:
case 'i': case 'i':
case ']': CALL_ (ctx->input, insert, "\x1d"); break; case ']': CALL_ (ctx->input, insert, "\x1d"); break;
case 'x' ^ 96:
case 'x':
case '^': CALL_ (ctx->input, insert, "\x1e"); break;
case 'u' ^ 96: case 'u' ^ 96:
case 'u': case 'u':
case '_': CALL_ (ctx->input, insert, "\x1f"); break; case '_': CALL_ (ctx->input, insert, "\x1f"); break;