Merged Irssi 0.8.2 from irssi.org cvs.
[silc.git] / apps / irssi / src / fe-common / core / themes.c
index c80c9e2d1190aaadc5b97cc46bc71bd48759b6e0..ec4a994af44a1f450b6df1822c22d0625098b2d1 100644 (file)
@@ -146,7 +146,9 @@ static void theme_format_append_variable(GString *str, const char **format)
        value = parse_special((char **) format, NULL, NULL,
                              args, &free_ret, NULL, PARSE_FLAG_ONLY_ARGS);
        if (free_ret) g_free(value);
-       (*format)++;
+
+       if (**format != '\0')
+               (*format)++;
 
        /* append the variable name */
        value = g_strndup(orig, (int) (*format-orig));
@@ -219,7 +221,7 @@ static void theme_format_append_next(THEME_REC *theme, GString *str,
        }
 
        index = (flags & EXPAND_FLAG_IGNORE_REPLACES) ? -1 :
-               theme->replace_keys[(int) chr];
+               theme->replace_keys[(int) (unsigned char) chr];
        if (index == -1)
                g_string_append_c(str, chr);
        else {
@@ -540,7 +542,7 @@ static void theme_read_replaces(CONFIG_REC *config, THEME_REC *theme)
 
                if (node->key != NULL && node->value != NULL) {
                        for (p = node->key; *p != '\0'; p++)
-                                theme->replace_keys[(int) *p] = index;
+                                theme->replace_keys[(int) (unsigned char) *p] = index;
 
                        theme->replace_values =
                                g_slist_append(theme->replace_values,
@@ -842,6 +844,8 @@ static int theme_read(THEME_REC *theme, const char *path, const char *data)
 
        theme->default_color =
                config_get_int(config, NULL, "default_color", -1);
+       theme->info_eol = config_get_bool(config, NULL, "info_eol", FALSE);
+
        /* FIXME: remove after 0.7.99 */
        if (theme->default_color == 0 &&
            config_get_int(config, NULL, "default_real_color", -1) != -1)
@@ -1155,6 +1159,8 @@ static void sig_complete_format(GList **list, WINDOW_REC *window,
 
        words = 0;
        do {
+                ptr++;
+
                words++;
                 ptr = strchr(ptr, ' ');
        } while (ptr != NULL);
@@ -1173,6 +1179,8 @@ static void change_theme(const char *name, int verbose)
        rec = theme_load(name);
        if (rec != NULL) {
                current_theme = rec;
+                signal_emit("theme changed", 1, rec);
+
                if (verbose) {
                        printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
                                    TXT_THEME_CHANGED,