mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
irc: add support of strikethrough color attribute (using half bright) (closes #2248)
As ncurses doesn't support strikethrough, the text is rendered as half bright (WeeChat color: "dim").
This commit is contained in:
@@ -8,6 +8,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
## Version 4.7.0 (under dev)
|
||||
|
||||
### Added
|
||||
|
||||
- irc: add support strikethrough text in IRC messages ([#2248](https://github.com/weechat/weechat/issues/2248))
|
||||
|
||||
### Fixed
|
||||
|
||||
- core: fix write of weechat.log to stdout with `weechat-headless --stdout` ([#2247](https://github.com/weechat/weechat/issues/2247))
|
||||
|
||||
@@ -1068,6 +1068,8 @@ Zeichen, genutzt werden:
|
||||
kbd:[yyyyyy] | Textfarbe `xxxxxx` und Hintergrundfarbe `yyyyyy` (RGB als hexadezimale Zahl).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Text wird kursiv dargestellt.
|
||||
| kbd:[Ctrl+c], kbd:[o] | deaktiviert Farben und Attribute.
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Farben umkehren (kehrt Textfarbe und Hintergrundfarbe um).
|
||||
| kbd:[Ctrl+c], kbd:[_] | Text wird mit Unterstrich dargestellt.
|
||||
|===
|
||||
@@ -1640,6 +1642,8 @@ Sie können mit dem Befehl <<command_weechat_key,/key>> geändert und neue hinzu
|
||||
| kbd:[Ctrl+c], kbd:[d] | fügt Steuerzeichen für Textfarbe ein (RGB Farbe, als hexadezimale Zahl). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | fügt Steuerzeichen für kursiven Text ein. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | fügt Steuerzeichen für Standardfarbe ein. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | fügt Steuerzeichen für Hintergrundfarbe ein. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | fügt Steuerzeichen für unterstrichenen Text ein. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1063,6 +1063,7 @@ follow (press kbd:[Ctrl+c] then following letter, with optional value):
|
||||
kbd:[yyyyyy] | Text color `xxxxxx` and background `yyyyyy` (RGB as hexadecimal).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Italic text.
|
||||
| kbd:[Ctrl+c], kbd:[o] | Disable color and attributes.
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Reverse video (revert text color with background).
|
||||
| kbd:[Ctrl+c], kbd:[_] | Underlined text.
|
||||
|===
|
||||
@@ -1632,6 +1633,7 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
|
||||
| kbd:[Ctrl+c], kbd:[d] | Insert code for colored text (RGB color, as hexadecimal). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Insert code for italic text. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Insert code for color reset. | `+/input insert \x0F+`
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Insert code for reverse color. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Insert code for underlined text. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1079,6 +1079,7 @@ suit et éventuellement une valeur) :
|
||||
kbd:[yyyyyy] | Couleur du texte `xxxxxx` et du fond `yyyyyy` (RGB en hexadécimal).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Texte en italique.
|
||||
| kbd:[Ctrl+c], kbd:[o] | Désactiver la couleur et tous les attributs.
|
||||
| kbd:[Ctrl+c], kbd:[s] | Texte barré (affiché en demi-intensité dans l'interface ncurses car le texte barré n'est pas supporté).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Vidéo inverse (inversion de la couleur d'écriture et du fond).
|
||||
| kbd:[Ctrl+c], kbd:[_] | Texte souligné.
|
||||
|===
|
||||
@@ -1667,6 +1668,8 @@ Ils peuvent être modifiés et de nouveaux peuvent être ajoutés avec la comman
|
||||
| kbd:[Ctrl+c], kbd:[d] | Insérer le code pour écrire en couleur (couleur RGB, en hexadécimal). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Insérer le code pour mettre le texte en italique. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Insérer le code pour réinitialiser la couleur. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Insérer le code pour écrire en couleur inversée. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Insérer le code pour écrire en souligné. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1170,6 +1170,8 @@ opzionale):
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[i] | italic text.
|
||||
| kbd:[Ctrl+c], kbd:[o] | disabilita colori ed attributi.
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | video inverso (inverte il colore del testo con quello di sfondo).
|
||||
| kbd:[Ctrl+c], kbd:[_] | testo sottolineato.
|
||||
|===
|
||||
@@ -1788,6 +1790,8 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
|
||||
| kbd:[Ctrl+c], kbd:[d] | Insert code for colored text (RGB color, as hexadecimal). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Inserisce il codice per il testo in corsivo. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Inserisce il codice per il reset dei colori. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Inserisce il codice per l'inversione dei colori. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Inserisce il codice per il testo sottolineato. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1146,6 +1146,8 @@ IRC 等のプラグインでは、以下の色コードと属性を利用でき
|
||||
kbd:[yyyyyy] | Text color `xxxxxx` and background `yyyyyy` (RGB as hexadecimal).
|
||||
| kbd:[Ctrl+c], kbd:[i] | テキストをイタリック体に
|
||||
| kbd:[Ctrl+c], kbd:[o] | テキスト表示色と属性をリセット
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | テキストを反転 (テキスト表示色と背景色の入れ替え)
|
||||
| kbd:[Ctrl+c], kbd:[_] | テキストに下線を引く
|
||||
|===
|
||||
@@ -1754,6 +1756,8 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
|
||||
| kbd:[Ctrl+c], kbd:[d] | Insert code for colored text (RGB color, as hexadecimal). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | テキストをイタリック体にするコードの挿入 | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | テキスト色のリセットを行うコードの挿入 | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | テキスト色の反転を行うコードの挿入 | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | テキストに下線を引くコードの挿入 | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1064,6 +1064,8 @@ Dla niektórych wtyczek jak IRC, można użyć kolorów i atrybutów w następuj
|
||||
kbd:[yyyyyy] | Kolor tekstu `xxxxxx` i tła `yyyyyy` (RGB jako wartości szesnastkowe).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Kursywa
|
||||
| kbd:[Ctrl+c], kbd:[o] | Wyłącza kolory i atrybuty
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Odwróć video (przywraca kolor tekstu i tła)
|
||||
| kbd:[Ctrl+c], kbd:[_] | Podkreślony tekst
|
||||
|===
|
||||
@@ -1637,6 +1639,8 @@ Można je zmienić oraz dodać nowe za pomocą komendy <<command_weechat_key,/ke
|
||||
| kbd:[Ctrl+c], kbd:[d] | Wstaw kod dla kolorowego tekstu (kolor RGB jaki liczba szesnastkowa). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Wstaw kod dla pochyłego tekstu. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Wstaw kod dla zresetowania koloru. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Wstaw kod dla odwrócenia koloru. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Wstaw kod dla podkreślonego tekstu. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -1002,6 +1002,8 @@ WeeChat командна линија (на дну прозора) вам омо
|
||||
kbd:[yyyyyy] | Текст у боји `xxxxxx` и позадина `yyyyyy` (RGB као хексадецимални број).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Текст у курзиву.
|
||||
| kbd:[Ctrl+c], kbd:[o] | Искључивање боје и атрибута.
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Обрнути видео (боје текста и позадине се замењују једна са другом).
|
||||
| kbd:[Ctrl+c], kbd:[_] | Подвучени текст.
|
||||
|===
|
||||
@@ -1547,6 +1549,8 @@ WeeChat нуди доста подразумеваних тастерских п
|
||||
| kbd:[Ctrl+c], kbd:[d] | Уметање кода за обојени текст (RGB боја, као хексадецимални број). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Уметање кода за текст у курзиву. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Уметање кода за ресет боје. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Уметање кода за обрнуту боју. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Уметање кода за подвучени текст. | `+/input insert \x1F+`
|
||||
|===
|
||||
|
||||
@@ -148,6 +148,7 @@ gui_key_default_bindings (int context, int create_option)
|
||||
BIND("ctrl-c,d", "/input insert \\x04");
|
||||
BIND("ctrl-c,i", "/input insert \\x1D");
|
||||
BIND("ctrl-c,o", "/input insert \\x0F");
|
||||
BIND("ctrl-c,s", "/input insert \\x1E");
|
||||
BIND("ctrl-c,v", "/input insert \\x16");
|
||||
BIND("ctrl-c,_", "/input insert \\x1F");
|
||||
BIND("meta-right", "/buffer +1");
|
||||
|
||||
@@ -215,7 +215,8 @@ irc_color_decode (const char *string, int keep_colors)
|
||||
char str_fg[16], str_bg[16], str_color[128], str_key[128], str_to_add[128];
|
||||
const char *remapped_color;
|
||||
unsigned char *ptr_string;
|
||||
int length, fg, bg, fg_term, bg_term, bold, reverse, italic, underline;
|
||||
int length, fg, bg, fg_term, bg_term;
|
||||
int bold, reverse, italic, strikethrough, underline;
|
||||
long fg_rgb, bg_rgb;
|
||||
|
||||
if (!string)
|
||||
@@ -230,6 +231,7 @@ irc_color_decode (const char *string, int keep_colors)
|
||||
bold = 0;
|
||||
reverse = 0;
|
||||
italic = 0;
|
||||
strikethrough = 0;
|
||||
underline = 0;
|
||||
|
||||
ptr_string = (unsigned char *)string;
|
||||
@@ -256,6 +258,7 @@ irc_color_decode (const char *string, int keep_colors)
|
||||
bold = 0;
|
||||
reverse = 0;
|
||||
italic = 0;
|
||||
strikethrough = 0;
|
||||
underline = 0;
|
||||
ptr_string++;
|
||||
break;
|
||||
@@ -277,6 +280,15 @@ irc_color_decode (const char *string, int keep_colors)
|
||||
italic ^= 1;
|
||||
ptr_string++;
|
||||
break;
|
||||
case IRC_COLOR_STRIKETHROUGH_CHAR:
|
||||
if (keep_colors)
|
||||
{
|
||||
snprintf (str_to_add, sizeof (str_to_add), "%s",
|
||||
weechat_color ((strikethrough) ? "-dim" : "dim"));
|
||||
}
|
||||
strikethrough ^= 1;
|
||||
ptr_string++;
|
||||
break;
|
||||
case IRC_COLOR_UNDERLINE_CHAR:
|
||||
if (keep_colors)
|
||||
{
|
||||
@@ -660,6 +672,11 @@ irc_color_encode (const char *string, int keep_colors)
|
||||
weechat_string_dyn_concat (out, IRC_COLOR_ITALIC_STR, -1);
|
||||
ptr_string++;
|
||||
break;
|
||||
case 0x1E: /* ^^ */
|
||||
if (keep_colors)
|
||||
weechat_string_dyn_concat (out, IRC_COLOR_STRIKETHROUGH_STR, -1);
|
||||
ptr_string++;
|
||||
break;
|
||||
case 0x1F: /* ^_ */
|
||||
if (keep_colors)
|
||||
weechat_string_dyn_concat (out, IRC_COLOR_UNDERLINE_STR, -1);
|
||||
@@ -740,6 +757,7 @@ irc_color_decode_ansi_cb (void *data, const char *text)
|
||||
ansi_state->bold = 0;
|
||||
ansi_state->underline = 0;
|
||||
ansi_state->italic = 0;
|
||||
ansi_state->strikethrough = 0;
|
||||
break;
|
||||
case 1: /* bold */
|
||||
if (!ansi_state->bold)
|
||||
@@ -771,6 +789,13 @@ irc_color_decode_ansi_cb (void *data, const char *text)
|
||||
ansi_state->underline = 1;
|
||||
}
|
||||
break;
|
||||
case 9: /* strikethrough */
|
||||
if (!ansi_state->strikethrough)
|
||||
{
|
||||
strcat (output, IRC_COLOR_STRIKETHROUGH_STR);
|
||||
ansi_state->strikethrough = 1;
|
||||
}
|
||||
break;
|
||||
case 23: /* remove italic */
|
||||
if (ansi_state->italic)
|
||||
{
|
||||
@@ -785,6 +810,13 @@ irc_color_decode_ansi_cb (void *data, const char *text)
|
||||
ansi_state->underline = 0;
|
||||
}
|
||||
break;
|
||||
case 29: /* remove strikethrough */
|
||||
if (ansi_state->strikethrough)
|
||||
{
|
||||
strcat (output, IRC_COLOR_STRIKETHROUGH_STR);
|
||||
ansi_state->strikethrough = 0;
|
||||
}
|
||||
break;
|
||||
case 30: /* text color */
|
||||
case 31:
|
||||
case 32:
|
||||
@@ -987,6 +1019,7 @@ irc_color_decode_ansi (const char *string, int keep_colors)
|
||||
ansi_state.bold = 0;
|
||||
ansi_state.underline = 0;
|
||||
ansi_state.italic = 0;
|
||||
ansi_state.strikethrough = 0;
|
||||
|
||||
return weechat_string_replace_regex (string, irc_color_regex_ansi,
|
||||
"$0", '$',
|
||||
|
||||
+18
-14
@@ -40,26 +40,29 @@
|
||||
|
||||
/* attributes in IRC messages for color & style (bold, ..) */
|
||||
|
||||
#define IRC_COLOR_BOLD_CHAR '\x02' /* bold text */
|
||||
#define IRC_COLOR_BOLD_STR "\x02" /* [02]...[02] */
|
||||
#define IRC_COLOR_BOLD_CHAR '\x02' /* bold text */
|
||||
#define IRC_COLOR_BOLD_STR "\x02" /* [02]...[02] */
|
||||
|
||||
#define IRC_COLOR_COLOR_CHAR '\x03' /* text color: fg/fg,bg/,bg */
|
||||
#define IRC_COLOR_COLOR_STR "\x03" /* [03]15,05...[03] */
|
||||
#define IRC_COLOR_COLOR_CHAR '\x03' /* text color: fg/fg,bg/,bg */
|
||||
#define IRC_COLOR_COLOR_STR "\x03" /* [03]15,05...[03] */
|
||||
|
||||
#define IRC_COLOR_HEX_COLOR_CHAR '\x04' /* text color (hex): fg/fg,bg/,bg */
|
||||
#define IRC_COLOR_HEX_COLOR_STR "\x04" /* [04]FFFF00,8B008B...[04] */
|
||||
#define IRC_COLOR_HEX_COLOR_CHAR '\x04' /* hex text col.: fg/fg,bg/,bg */
|
||||
#define IRC_COLOR_HEX_COLOR_STR "\x04" /* [04]FFFF00,8B008B...[04] */
|
||||
|
||||
#define IRC_COLOR_RESET_CHAR '\x0F' /* reset color/attributes */
|
||||
#define IRC_COLOR_RESET_STR "\x0F" /* [0F]... */
|
||||
#define IRC_COLOR_RESET_CHAR '\x0F' /* reset color/attributes */
|
||||
#define IRC_COLOR_RESET_STR "\x0F" /* [0F]... */
|
||||
|
||||
#define IRC_COLOR_REVERSE_CHAR '\x16' /* reverse video (fg <--> bg) */
|
||||
#define IRC_COLOR_REVERSE_STR "\x16" /* [16]...[16] */
|
||||
#define IRC_COLOR_REVERSE_CHAR '\x16' /* reverse video (fg <--> bg) */
|
||||
#define IRC_COLOR_REVERSE_STR "\x16" /* [16]...[16] */
|
||||
|
||||
#define IRC_COLOR_ITALIC_CHAR '\x1D' /* italic text */
|
||||
#define IRC_COLOR_ITALIC_STR "\x1D" /* [1D]...[1D] */
|
||||
#define IRC_COLOR_ITALIC_CHAR '\x1D' /* italic text */
|
||||
#define IRC_COLOR_ITALIC_STR "\x1D" /* [1D]...[1D] */
|
||||
|
||||
#define IRC_COLOR_UNDERLINE_CHAR '\x1F' /* underlined text */
|
||||
#define IRC_COLOR_UNDERLINE_STR "\x1F" /* [1F]...[1F] */
|
||||
#define IRC_COLOR_STRIKETHROUGH_CHAR '\x1E' /* strikethrough text */
|
||||
#define IRC_COLOR_STRIKETHROUGH_STR "\x1E" /* [1E]...[1E] */
|
||||
|
||||
#define IRC_COLOR_UNDERLINE_CHAR '\x1F' /* underlined text */
|
||||
#define IRC_COLOR_UNDERLINE_STR "\x1F" /* [1F]...[1F] */
|
||||
|
||||
#define IRC_COLOR_TERM2IRC_NUM_COLORS 16
|
||||
|
||||
@@ -117,6 +120,7 @@ struct t_irc_color_ansi_state
|
||||
char bold;
|
||||
char underline;
|
||||
char italic;
|
||||
char strikethrough;
|
||||
};
|
||||
|
||||
extern char *irc_color_decode (const char *string, int keep_colors);
|
||||
|
||||
@@ -47,6 +47,8 @@ extern int irc_color_convert_term2irc (int color);
|
||||
"test_" IRC_COLOR_REVERSE_STR "reverse" IRC_COLOR_REVERSE_STR "_end"
|
||||
#define STRING_IRC_ITALIC \
|
||||
"test_" IRC_COLOR_ITALIC_STR "italic" IRC_COLOR_ITALIC_STR "_end"
|
||||
#define STRING_IRC_STRIKETHROUGH \
|
||||
"test_" IRC_COLOR_STRIKETHROUGH_STR "strikethrough" IRC_COLOR_STRIKETHROUGH_STR "_end"
|
||||
#define STRING_IRC_UNDERLINE \
|
||||
"test_" IRC_COLOR_UNDERLINE_STR "underline" IRC_COLOR_UNDERLINE_STR "_end"
|
||||
#define STRING_IRC_COLOR_RESET \
|
||||
@@ -62,8 +64,10 @@ extern int irc_color_convert_term2irc (int color);
|
||||
IRC_COLOR_BOLD_STR \
|
||||
IRC_COLOR_REVERSE_STR \
|
||||
IRC_COLOR_ITALIC_STR \
|
||||
IRC_COLOR_STRIKETHROUGH_STR \
|
||||
IRC_COLOR_UNDERLINE_STR \
|
||||
IRC_COLOR_UNDERLINE_STR \
|
||||
IRC_COLOR_STRIKETHROUGH_STR \
|
||||
IRC_COLOR_ITALIC_STR \
|
||||
IRC_COLOR_REVERSE_STR \
|
||||
IRC_COLOR_BOLD_STR
|
||||
@@ -96,6 +100,8 @@ extern int irc_color_convert_term2irc (int color);
|
||||
"test_" "\x16" "reverse" "\x16" "_end"
|
||||
#define STRING_USER_ITALIC \
|
||||
"test_" "\x1D" "italic" "\x1D" "_end"
|
||||
#define STRING_USER_STRIKETHROUGH \
|
||||
"test_" "\x1E" "strikethrough" "\x1E" "_end"
|
||||
#define STRING_USER_UNDERLINE \
|
||||
"test_" "\x1F" "underline" "\x1F" "_end"
|
||||
#define STRING_USER_FG_LIGHTCYAN \
|
||||
@@ -103,8 +109,8 @@ extern int irc_color_convert_term2irc (int color);
|
||||
#define STRING_USER_FG_LIGHTCYAN_BG_RED \
|
||||
"test_" "\x03" "11,05" "lightcyan/red" "\x03" "_end"
|
||||
#define STRING_USER_ONLY_ATTRS_AND_COLORS \
|
||||
"\x03" "\x0F" "\x02" "\x16" "\x1D" "\x1F" \
|
||||
"\x1F" "\x1D" "\x16" "\x02"
|
||||
"\x03" "\x0F" "\x02" "\x16" "\x1D" "\x1E" "\x1F" "\x1F" "\x1E" \
|
||||
"\x1D" "\x16" "\x02"
|
||||
#define STRING_USER_ATTRS_AND_COLORS \
|
||||
"test_" "\x02" "\x1F" "\x03" "08,02" "bold_underline_yellow/blue" \
|
||||
"\x02" "\x1F" "_normal_yellow/blue"
|
||||
@@ -122,6 +128,8 @@ extern int irc_color_convert_term2irc (int color);
|
||||
"\x1B[1mbold3\x1B[22m_normal"
|
||||
#define STRING_ANSI_ITALIC \
|
||||
"test_\x1B[3mitalic\x1B[23m_normal"
|
||||
#define STRING_ANSI_STRIKETHROUGH \
|
||||
"test_\x1B[9mstrikethrough\x1B[29m_normal"
|
||||
#define STRING_ANSI_UNDERLINE \
|
||||
"test_\x1B[4munderline\x1B[24m_normal"
|
||||
#define STRING_ANSI_FG_BLUE \
|
||||
@@ -258,6 +266,14 @@ TEST(IrcColor, Decode)
|
||||
gui_color_get_custom ("-italic"));
|
||||
WEE_CHECK_DECODE(string, STRING_IRC_ITALIC, 1);
|
||||
|
||||
/* strikethrough */
|
||||
WEE_CHECK_DECODE("test_strikethrough_end", STRING_IRC_STRIKETHROUGH, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sstrikethrough%s_end",
|
||||
gui_color_get_custom ("dim"),
|
||||
gui_color_get_custom ("-dim"));
|
||||
WEE_CHECK_DECODE(string, STRING_IRC_STRIKETHROUGH, 1);
|
||||
|
||||
/* underline */
|
||||
WEE_CHECK_DECODE("test_underline_end", STRING_IRC_UNDERLINE, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
@@ -297,14 +313,14 @@ TEST(IrcColor, Decode)
|
||||
gui_color_get_custom ("resetcolor"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("bold"),
|
||||
"", /* fixed */
|
||||
gui_color_get_custom ("reverse"),
|
||||
gui_color_get_custom ("italic"),
|
||||
gui_color_get_custom ("dim"),
|
||||
gui_color_get_custom ("underline"),
|
||||
gui_color_get_custom ("-underline"),
|
||||
gui_color_get_custom ("-dim"),
|
||||
gui_color_get_custom ("-italic"),
|
||||
gui_color_get_custom ("-reverse"),
|
||||
"", /* fixed */
|
||||
gui_color_get_custom ("-bold"));
|
||||
WEE_CHECK_DECODE(string, STRING_IRC_ONLY_ATTRS_AND_COLORS, 1);
|
||||
|
||||
@@ -411,6 +427,14 @@ TEST(IrcColor, Encode)
|
||||
IRC_COLOR_ITALIC_STR);
|
||||
WEE_CHECK_ENCODE(string, STRING_USER_ITALIC, 1);
|
||||
|
||||
/* strikethrough */
|
||||
WEE_CHECK_ENCODE("test_strikethrough_end", STRING_USER_STRIKETHROUGH, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sstrikethrough%s_end",
|
||||
IRC_COLOR_STRIKETHROUGH_STR,
|
||||
IRC_COLOR_STRIKETHROUGH_STR);
|
||||
WEE_CHECK_ENCODE(string, STRING_USER_STRIKETHROUGH, 1);
|
||||
|
||||
/* underline */
|
||||
WEE_CHECK_ENCODE("test_underline_end", STRING_USER_UNDERLINE, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
@@ -439,14 +463,16 @@ TEST(IrcColor, Encode)
|
||||
/* color: only attributes and colors */
|
||||
WEE_CHECK_ENCODE("", STRING_USER_ONLY_ATTRS_AND_COLORS, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"%s%s%s%s%s%s%s%s%s%s",
|
||||
"%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||
IRC_COLOR_COLOR_STR,
|
||||
IRC_COLOR_RESET_STR,
|
||||
IRC_COLOR_BOLD_STR,
|
||||
IRC_COLOR_REVERSE_STR,
|
||||
IRC_COLOR_ITALIC_STR,
|
||||
IRC_COLOR_STRIKETHROUGH_STR,
|
||||
IRC_COLOR_UNDERLINE_STR,
|
||||
IRC_COLOR_UNDERLINE_STR,
|
||||
IRC_COLOR_STRIKETHROUGH_STR,
|
||||
IRC_COLOR_ITALIC_STR,
|
||||
IRC_COLOR_REVERSE_STR,
|
||||
IRC_COLOR_BOLD_STR);
|
||||
@@ -543,6 +569,14 @@ TEST(IrcColor, DecodeAnsi)
|
||||
IRC_COLOR_ITALIC_STR);
|
||||
WEE_CHECK_DECODE_ANSI(string, STRING_ANSI_ITALIC, 1);
|
||||
|
||||
/* strikethrough */
|
||||
WEE_CHECK_DECODE_ANSI("test_strikethrough_normal", STRING_ANSI_STRIKETHROUGH, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
"test_%sstrikethrough%s_normal",
|
||||
IRC_COLOR_STRIKETHROUGH_STR,
|
||||
IRC_COLOR_STRIKETHROUGH_STR);
|
||||
WEE_CHECK_DECODE_ANSI(string, STRING_ANSI_STRIKETHROUGH, 1);
|
||||
|
||||
/* underline */
|
||||
WEE_CHECK_DECODE_ANSI("test_underline_normal", STRING_ANSI_UNDERLINE, 0);
|
||||
snprintf (string, sizeof (string),
|
||||
|
||||
Reference in New Issue
Block a user