diff mcabber/mcabber/screen.c @ 1965:ec737f5f1d6f

Couple of readmark-related bugfixes
author Mikael Berthe <mikael@lilotux.net>
date Fri, 18 Mar 2011 12:29:57 +0100
parents 39021fd6b0e1
children 83d7c7daea6a
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Tue Mar 15 14:14:20 2011 +0100
+++ b/mcabber/mcabber/screen.c	Fri Mar 18 12:29:57 2011 +0100
@@ -1056,6 +1056,9 @@
       tmp->bd = g_new0(buffdata, 1);
       hlog_read_history(title, &tmp->bd->hbuf,
                         maxX - Roster_Width - scr_getprefixwidth());
+
+      // Set a readmark to separate new content
+      hbuf_set_readmark(tmp->bd->hbuf, TRUE);
     }
 
     id = g_strdup(title);
@@ -1137,7 +1140,7 @@
   char pref[96];
   hbb_line **lines, *line;
   GList *hbuf_head;
-  int color;
+  int color = COLOR_GENERAL;
   bool readmark = FALSE;
   bool skipline = FALSE;
 
@@ -1285,10 +1288,6 @@
       wprintw(win_entry->win, "%s", line->text+line->mucnicklen);
       wclrtoeol(win_entry->win);
 
-      // Return the color back
-      if (color != COLOR_GENERAL)
-        wattrset(win_entry->win, get_color(COLOR_GENERAL));
-
 scr_update_window_skipline:
       skipline = FALSE;
       if (readmark && line->flags & HBB_PREFIX_READMARK) {
@@ -1298,7 +1297,8 @@
         // Display the mark
         winy = n + mark_offset;
         wmove(win_entry->win, winy, 0);
-        wattrset(win_entry->win, get_color(COLOR_READMARK));
+        color = COLOR_READMARK;
+        wattrset(win_entry->win, get_color(color));
         g_snprintf(pref, prefixwidth, "             == ");
         wprintw(win_entry->win, pref);
         w = scr_gettextwidth() / 3;
@@ -1308,6 +1308,10 @@
         wattrset(win_entry->win, get_color(COLOR_GENERAL));
       }
 
+      // Restore default ("general") color
+      if (color != COLOR_GENERAL)
+        wattrset(win_entry->win, get_color(COLOR_GENERAL));
+
       g_free(line->text);
       g_free(line);
     } else {