summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-12 19:43:32 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-12 19:43:32 +0000
commit1d453ed92c17c657e1a9984b6566a6f761214237 (patch)
treef24e6c8bdcc6251123cbd3034951e3ce7287e4d6 /src
parent7ced2beab412c51b80155bd7ef98f9fff117f6d1 (diff)
downloadirssi-1d453ed92c17c657e1a9984b6566a6f761214237.zip
%n+bg color change doesn't anymore set foreground black. changed theme's
default_bold_color to default_real_color. Activity list printed first item with white always. Color redrawed itself every second. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1381 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/core/themes.c6
-rw-r--r--src/fe-common/core/themes.h7
-rw-r--r--src/fe-text/gui-printtext.c13
-rw-r--r--src/fe-text/statusbar-items.c12
4 files changed, 24 insertions, 14 deletions
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index a2a9f806..5646b7bc 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -740,8 +740,8 @@ static int theme_read(THEME_REC *theme, const char *path, const char *data)
theme->default_color =
config_get_int(config, NULL, "default_color", 0);
- theme->default_bold_color =
- config_get_int(config, NULL, "default_bold_color", 7);
+ theme->default_real_color =
+ config_get_int(config, NULL, "default_real_color", 7);
theme_read_replaces(config, theme);
theme_read_abstracts(config, theme);
@@ -1069,7 +1069,7 @@ static void themes_read(void)
g_get_home_dir());
current_theme = theme_create(fname, "default");
current_theme->default_color = 0;
- current_theme->default_bold_color = 7;
+ current_theme->default_real_color = 7;
theme_read(current_theme, NULL, default_theme);
g_free(fname);
}
diff --git a/src/fe-common/core/themes.h b/src/fe-common/core/themes.h
index 3305c7bb..d1e0283f 100644
--- a/src/fe-common/core/themes.h
+++ b/src/fe-common/core/themes.h
@@ -15,7 +15,12 @@ typedef struct {
char *name;
time_t last_modify;
- int default_color, default_bold_color;
+ int default_color; /* default color to use with text with default
+ background. default is 0 which means the default
+ color set by terminal */
+ int default_real_color; /* default color to use with background set.
+ this shouldn't be 0, unless black is really
+ wanted. default is 7 (white). */
GHashTable *modules;
GSList *replace_keys;
diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c
index 6f6dd829..5f8efdad 100644
--- a/src/fe-text/gui-printtext.c
+++ b/src/fe-text/gui-printtext.c
@@ -282,16 +282,17 @@ static void get_colors(int flags, int *fg, int *bg)
if (flags & PRINTFLAG_MIRC_COLOR) {
/* mirc colors - real range is 0..15, but after 16
colors wrap to 0, 1, ... */
- *fg = *fg < 0 ?
- current_theme->default_color : mirc_colors[*fg % 16];
*bg = *bg < 0 ? 0 : mirc_colors[*bg % 16];
+ if (*fg > 0) *fg = mirc_colors[*fg % 16];
} else {
/* default colors */
- *fg = *fg < 0 || *fg > 15 ?
- current_theme->default_color : *fg;
*bg = *bg < 0 || *bg > 15 ? 0 : *bg;
+ if (*fg > 8) *fg &= ~8;
+ }
- if (*fg > 8) *fg -= 8;
+ if (*fg < 0 || *fg > 15) {
+ *fg = *bg == 0 ? current_theme->default_color :
+ current_theme->default_real_color;
}
if (flags & PRINTFLAG_REVERSE) {
@@ -302,7 +303,7 @@ static void get_colors(int flags, int *fg, int *bg)
if (*fg == 8) *fg |= ATTR_COLOR8;
if (flags & PRINTFLAG_BOLD) {
- if (*fg == 0) *fg = current_theme->default_bold_color;
+ if (*fg == 0) *fg = current_theme->default_real_color;
*fg |= 8;
}
if (flags & PRINTFLAG_UNDERLINE) *fg |= ATTR_UNDERLINE;
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 3d3de0fa..2a91bb14 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -96,7 +96,7 @@ static void item_default(SBAR_ITEM_REC *item, int get_size_only,
{
SERVER_REC *server;
WI_ITEM_REC *wiitem;
- char *parsed, *printstr;
+ char *stripped, *parsed, *printstr;
int len;
if (active_win == NULL) {
@@ -109,6 +109,8 @@ static void item_default(SBAR_ITEM_REC *item, int get_size_only,
parsed = parse_special_string(str, server, wiitem, "", NULL,
PARSE_FLAG_ESCAPE_VARS);
+ stripped = strip_codes(parsed);
+ g_free(parsed); parsed = stripped;
if (get_size_only) {
item->min_size = item->max_size = format_get_length(parsed);
@@ -119,7 +121,7 @@ static void item_default(SBAR_ITEM_REC *item, int get_size_only,
parsed[len] = '\0';
}
- printstr = g_strconcat("%4", parsed, NULL);
+ printstr = g_strconcat("%n%4", parsed, NULL);
gui_printtext(item->xpos, item->bar->ypos, printstr);
g_free(printstr);
}
@@ -147,6 +149,7 @@ static int statusbar_clock_timeout(void)
if (tm->tm_min != min) {
/* minute changed, redraw! */
+ clock_last = t;
statusbar_item_redraw(clock_item);
}
return 1;
@@ -240,8 +243,9 @@ static char *get_activity_list(int normal, int hilight)
if ((!is_det && !normal) || (is_det && !hilight))
continue;
- if (str->len > 0)
- g_string_append(str, "%c,");
+ g_string_append(str, "%c");
+ if (str->len > 2)
+ g_string_append_c(str, ',');
switch (window->data_level) {
case DATA_LEVEL_NONE: