summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-11 17:58:35 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-11 18:07:26 +0200
commit529a46ad415ad42d6e4a1ac1f85dd72a1993398c (patch)
treeec0b9653a4b119008e7042d48c41ba24e92f49a2
parentf9ef1231716c1141391662476e93c9b19dbc3510 (diff)
downloadxK-529a46ad415ad42d6e4a1ac1f85dd72a1993398c.tar.gz
xK-529a46ad415ad42d6e4a1ac1f85dd72a1993398c.tar.xz
xK-529a46ad415ad42d6e4a1ac1f85dd72a1993398c.zip
degesch: add support for crossed-out text
Assuming that sgr0 includes rmxx behaviour, which should be true.
-rw-r--r--degesch.c31
1 files 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;