summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c10
-rw-r--r--src/core/wee-config.c11
-rw-r--r--src/gui/curses/gui-curses-color.c9
-rw-r--r--src/gui/curses/gui-curses-window.c40
-rw-r--r--src/gui/curses/gui-curses.h2
-rw-r--r--src/gui/curses/headless/ncurses-fake.h2
-rw-r--r--src/gui/gui-color.c80
-rw-r--r--src/gui/gui-color.h6
8 files changed, 147 insertions, 13 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 5fb9201bb..7dbb0d729 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -3157,9 +3157,13 @@ COMMAND_CALLBACK(help)
"(light)cyan), a terminal color number or "
"an alias; attributes are allowed before "
"color (for text color only, not "
- "background): \"*\" for bold, \"!\" for "
- "reverse, \"/\" for italic, \"_\" for "
- "underline"));
+ "background): "
+ "\"%\" for blink, "
+ "\".\" for \"dim\" (half bright), "
+ "\"*\" for bold, "
+ "\"!\" for reverse, "
+ "\"/\" for italic, "
+ "\"_\" for underline"));
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: %s",
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 8b1cdb556..c5bb8cd3f 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -3058,9 +3058,14 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"emphasized_attributes", "string",
N_("attributes for emphasized text: one or more attribute chars ("
- "\"*\" for bold, \"!\" for reverse, \"/\" for italic, \"_\" for "
- "underline); if the string is empty, the colors "
- "weechat.color.emphasized* are used"),
+ "\"%\" for blink, "
+ "\".\" for \"dim\" (half bright), "
+ "\"*\" for bold, "
+ "\"!\" for reverse, "
+ "\"/\" for italic, "
+ "\"_\" for underline); "
+ "if the string is empty, "
+ "the colors weechat.color.emphasized* are used"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
&config_change_emphasized_attributes, NULL, NULL,
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index 47b002fd7..48e9eda4c 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -165,6 +165,10 @@ gui_color_get_gui_attrs (int color)
attributes = 0;
+ if (color & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ attributes |= A_BLINK;
+ if (color & GUI_COLOR_EXTENDED_DIM_FLAG)
+ attributes |= A_DIM;
if (color & GUI_COLOR_EXTENDED_BOLD_FLAG)
attributes |= A_BOLD;
if (color & GUI_COLOR_EXTENDED_REVERSE_FLAG)
@@ -173,7 +177,6 @@ gui_color_get_gui_attrs (int color)
attributes |= A_ITALIC;
if (color & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
attributes |= A_UNDERLINE;
-
return attributes;
}
@@ -188,6 +191,10 @@ gui_color_get_extended_flags (int attrs)
flags = 0;
+ if (attrs & A_BLINK)
+ flags |= GUI_COLOR_EXTENDED_BLINK_FLAG;
+ if (attrs & A_DIM)
+ flags |= GUI_COLOR_EXTENDED_DIM_FLAG;
if (attrs & A_BOLD)
flags |= GUI_COLOR_EXTENDED_BOLD_FLAG;
if (attrs & A_REVERSE)
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index e9d80d179..416db4c0c 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -396,6 +396,14 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
{
+ if (fg & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ gui_window_set_color_style (window, A_BLINK);
+ else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
+ gui_window_remove_color_style (window, A_BLINK);
+ if (fg & GUI_COLOR_EXTENDED_DIM_FLAG)
+ gui_window_set_color_style (window, A_DIM);
+ else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
+ gui_window_remove_color_style (window, A_DIM);
if (fg & GUI_COLOR_EXTENDED_BOLD_FLAG)
gui_window_set_color_style (window, A_BOLD);
else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
@@ -483,6 +491,14 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg,
{
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
{
+ if (fg & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ gui_window_set_color_style (window, A_BLINK);
+ else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
+ gui_window_remove_color_style (window, A_BLINK);
+ if (fg & GUI_COLOR_EXTENDED_DIM_FLAG)
+ gui_window_set_color_style (window, A_DIM);
+ else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
+ gui_window_remove_color_style (window, A_DIM);
if (fg & GUI_COLOR_EXTENDED_BOLD_FLAG)
gui_window_set_color_style (window, A_BOLD);
else if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
@@ -587,6 +603,10 @@ gui_window_emphasize (WINDOW *window, int x, int y, int count)
ptr_attrs = &attrs;
ptr_pair = &pair;
wattr_get (window, ptr_attrs, ptr_pair, NULL);
+ if (config_emphasized_attributes & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ attrs ^= A_BLINK;
+ if (config_emphasized_attributes & GUI_COLOR_EXTENDED_DIM_FLAG)
+ attrs ^= A_DIM;
if (config_emphasized_attributes & GUI_COLOR_EXTENDED_BOLD_FLAG)
attrs ^= A_BOLD;
if (config_emphasized_attributes & GUI_COLOR_EXTENDED_REVERSE_FLAG)
@@ -947,6 +967,16 @@ gui_window_string_apply_color_set_attr (unsigned char **string, WINDOW *window)
switch (ptr_string[0])
{
+ case GUI_COLOR_ATTR_BLINK_CHAR:
+ ptr_string++;
+ if (window)
+ gui_window_set_color_style (window, A_BLINK);
+ break;
+ case GUI_COLOR_ATTR_DIM_CHAR:
+ ptr_string++;
+ if (window)
+ gui_window_set_color_style (window, A_DIM);
+ break;
case GUI_COLOR_ATTR_BOLD_CHAR:
ptr_string++;
if (window)
@@ -988,6 +1018,16 @@ gui_window_string_apply_color_remove_attr (unsigned char **string, WINDOW *windo
switch (ptr_string[0])
{
+ case GUI_COLOR_ATTR_BLINK_CHAR:
+ ptr_string++;
+ if (window)
+ gui_window_remove_color_style (window, A_BLINK);
+ break;
+ case GUI_COLOR_ATTR_DIM_CHAR:
+ ptr_string++;
+ if (window)
+ gui_window_remove_color_style (window, A_DIM);
+ break;
case GUI_COLOR_ATTR_BOLD_CHAR:
ptr_string++;
if (window)
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index ae1905073..ba9511b39 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -46,7 +46,7 @@ struct t_gui_bar_window;
#define A_ITALIC 0
#endif /* A_ITALIC */
-#define A_ALL_ATTR A_BOLD | A_UNDERLINE | A_REVERSE | A_ITALIC
+#define A_ALL_ATTR A_BLINK | A_DIM | A_BOLD | A_UNDERLINE | A_REVERSE | A_ITALIC
#define GUI_WINDOW_OBJECTS(window) \
((struct t_gui_window_curses_objects *)(window->gui_objects))
diff --git a/src/gui/curses/headless/ncurses-fake.h b/src/gui/curses/headless/ncurses-fake.h
index e79c59b67..18e8b8080 100644
--- a/src/gui/curses/headless/ncurses-fake.h
+++ b/src/gui/curses/headless/ncurses-fake.h
@@ -45,6 +45,8 @@
#define COLOR_WHITE 7
#define A_NORMAL 0
+#define A_BLINK (1 << (11 + 8))
+#define A_DIM (1 << (12 + 8))
#define A_BOLD (1 << (13 + 8))
#define A_UNDERLINE (1 << (9 + 8))
#define A_REVERSE (1 << (10 + 8))
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index 1bd0aca63..68c1e690d 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -187,6 +187,12 @@ gui_color_search_config (const char *color_name)
int
gui_color_attr_get_flag (char c)
{
+ if (c == GUI_COLOR_EXTENDED_BLINK_CHAR)
+ return GUI_COLOR_EXTENDED_BLINK_FLAG;
+
+ if (c == GUI_COLOR_EXTENDED_DIM_CHAR)
+ return GUI_COLOR_EXTENDED_DIM_FLAG;
+
if (c == GUI_COLOR_EXTENDED_BOLD_CHAR)
return GUI_COLOR_EXTENDED_BOLD_FLAG;
@@ -218,6 +224,10 @@ gui_color_attr_build_string (int color, char *str_attr)
i = 0;
+ if (color & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ str_attr[i++] = GUI_COLOR_EXTENDED_BLINK_CHAR;
+ if (color & GUI_COLOR_EXTENDED_DIM_FLAG)
+ str_attr[i++] = GUI_COLOR_EXTENDED_DIM_CHAR;
if (color & GUI_COLOR_EXTENDED_BOLD_FLAG)
str_attr[i++] = GUI_COLOR_EXTENDED_BOLD_CHAR;
if (color & GUI_COLOR_EXTENDED_REVERSE_FLAG)
@@ -286,6 +296,34 @@ gui_color_get_custom (const char *color_name)
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_EMPHASIS_CHAR);
}
+ else if (string_strcasecmp (ptr_color_name, "blink") == 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%c%c",
+ GUI_COLOR_SET_ATTR_CHAR,
+ GUI_COLOR_ATTR_BLINK_CHAR);
+ }
+ else if (string_strcasecmp (ptr_color_name, "-blink") == 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%c%c",
+ GUI_COLOR_REMOVE_ATTR_CHAR,
+ GUI_COLOR_ATTR_BLINK_CHAR);
+ }
+ else if (string_strcasecmp (ptr_color_name, "dim") == 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%c%c",
+ GUI_COLOR_SET_ATTR_CHAR,
+ GUI_COLOR_ATTR_DIM_CHAR);
+ }
+ else if (string_strcasecmp (ptr_color_name, "-dim") == 0)
+ {
+ snprintf (color[index_color], sizeof (color[index_color]),
+ "%c%c",
+ GUI_COLOR_REMOVE_ATTR_CHAR,
+ GUI_COLOR_ATTR_DIM_CHAR);
+ }
else if (string_strcasecmp (ptr_color_name, "bold") == 0)
{
snprintf (color[index_color], sizeof (color[index_color]),
@@ -1007,10 +1045,8 @@ gui_color_decode_ansi_cb (void *data, const char *text)
case 1: /* bold */
strcat (output, gui_color_get_custom ("bold"));
break;
- case 2: /* remove bold */
- case 21:
- case 22:
- strcat (output, gui_color_get_custom ("-bold"));
+ case 2: /* dim */
+ strcat (output, gui_color_get_custom ("dim"));
break;
case 3: /* italic */
strcat (output, gui_color_get_custom ("italic"));
@@ -1018,15 +1054,27 @@ gui_color_decode_ansi_cb (void *data, const char *text)
case 4: /* underline */
strcat (output, gui_color_get_custom ("underline"));
break;
+ case 5: /* blink */
+ strcat (output, gui_color_get_custom ("blink"));
+ break;
case 7: /* reverse */
strcat (output, gui_color_get_custom ("reverse"));
break;
+ case 21: /* remove bold */
+ strcat (output, gui_color_get_custom ("-bold"));
+ break;
+ case 22: /* remove dim */
+ strcat (output, gui_color_get_custom ("-dim"));
+ break;
case 23: /* remove italic */
strcat (output, gui_color_get_custom ("-italic"));
break;
case 24: /* remove underline */
strcat (output, gui_color_get_custom ("-underline"));
break;
+ case 25: /* remove blink */
+ strcat (output, gui_color_get_custom ("-blink"));
+ break;
case 27: /* remove reverse */
strcat (output, gui_color_get_custom ("-reverse"));
break;
@@ -1202,6 +1250,12 @@ gui_color_add_ansi_flag (char **output, int flag)
{
switch (flag)
{
+ case GUI_COLOR_EXTENDED_BLINK_FLAG:
+ string_dyn_concat (output, "\x1B[5m", -1);
+ break;
+ case GUI_COLOR_EXTENDED_DIM_FLAG:
+ string_dyn_concat (output, "\x1B[2m", -1);
+ break;
case GUI_COLOR_EXTENDED_BOLD_FLAG:
string_dyn_concat (output, "\x1B[1m", -1);
break;
@@ -1545,6 +1599,10 @@ gui_color_encode_ansi (const char *string)
attrs = gui_color_get_extended_flags (
gui_color[color]->attributes);
string_dyn_concat (out, "\x1B[0m", -1);
+ if (attrs & GUI_COLOR_EXTENDED_BLINK_FLAG)
+ string_dyn_concat (out, "\x1B[5m", -1);
+ if (attrs & GUI_COLOR_EXTENDED_DIM_FLAG)
+ string_dyn_concat (out, "\x1B[2m", -1);
if (attrs & GUI_COLOR_EXTENDED_BOLD_FLAG)
string_dyn_concat (out, "\x1B[1m", -1);
if (attrs & GUI_COLOR_EXTENDED_REVERSE_FLAG)
@@ -1591,6 +1649,12 @@ gui_color_encode_ansi (const char *string)
{
switch (ptr_string[0])
{
+ case GUI_COLOR_ATTR_BLINK_CHAR:
+ string_dyn_concat (out, "\x1B[5m", -1);
+ break;
+ case GUI_COLOR_ATTR_DIM_CHAR:
+ string_dyn_concat (out, "\x1B[2m", -1);
+ break;
case GUI_COLOR_ATTR_BOLD_CHAR:
string_dyn_concat (out, "\x1B[1m", -1);
break;
@@ -1613,7 +1677,13 @@ gui_color_encode_ansi (const char *string)
{
switch (ptr_string[0])
{
- case GUI_COLOR_ATTR_BOLD_CHAR:
+ case GUI_COLOR_ATTR_BLINK_CHAR:
+ string_dyn_concat (out, "\x1B[25m", -1);
+ break;
+ case GUI_COLOR_ATTR_DIM_CHAR:
+ string_dyn_concat (out, "\x1B[22m", -1);
+ break;
+ case GUI_COLOR_ATTR_BOLD_CHAR:
string_dyn_concat (out, "\x1B[21m", -1);
break;
case GUI_COLOR_ATTR_REVERSE_CHAR:
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 799fd76bd..a5a413e57 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -104,6 +104,8 @@ enum t_gui_color_enum
#define GUI_COLOR_ATTR_REVERSE_CHAR '\x02'
#define GUI_COLOR_ATTR_ITALIC_CHAR '\x03'
#define GUI_COLOR_ATTR_UNDERLINE_CHAR '\x04'
+#define GUI_COLOR_ATTR_BLINK_CHAR '\x05'
+#define GUI_COLOR_ATTR_DIM_CHAR '\x06'
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR "\x1C"
@@ -117,6 +119,8 @@ enum t_gui_color_enum
#define GUI_COLOR_BG_CHAR 'B'
#define GUI_COLOR_FG_BG_CHAR '*'
#define GUI_COLOR_EXTENDED_CHAR '@'
+#define GUI_COLOR_EXTENDED_BLINK_CHAR '%'
+#define GUI_COLOR_EXTENDED_DIM_CHAR '.'
#define GUI_COLOR_EXTENDED_BOLD_CHAR '*'
#define GUI_COLOR_EXTENDED_REVERSE_CHAR '!'
#define GUI_COLOR_EXTENDED_ITALIC_CHAR '/'
@@ -142,6 +146,8 @@ enum t_gui_color_enum
#define GUI_COLOR_EXTENDED_ITALIC_FLAG 0x0800000
#define GUI_COLOR_EXTENDED_UNDERLINE_FLAG 0x1000000
#define GUI_COLOR_EXTENDED_KEEPATTR_FLAG 0x2000000
+#define GUI_COLOR_EXTENDED_BLINK_FLAG 0x4000000
+#define GUI_COLOR_EXTENDED_DIM_FLAG 0x8000000
#define GUI_COLOR_EXTENDED_MASK 0x00FFFFF
#define GUI_COLOR_EXTENDED_MAX 99999