changeset 1954:256cfc706ae5

Update readmark support Fix two small issues with readmarks.
author Mikael Berthe <mikael@lilotux.net>
date Mon, 14 Mar 2011 14:25:21 +0100
parents 9f443617e96b
children fad27c72a229
files mcabber/mcabber/screen.c
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Mon Mar 14 13:17:17 2011 +0100
+++ b/mcabber/mcabber/screen.c	Mon Mar 14 14:25:21 2011 +0100
@@ -1174,20 +1174,23 @@
     // Do we have a read mark?
     for (n = 0; n < CHAT_WIN_HEIGHT; n++) {
       line = *(lines+n);
-      if (line && line->flags & HBB_PREFIX_READMARK) {
-        // If this is not the last line, we'll display a mark
-        if (n+1 < CHAT_WIN_HEIGHT && *(lines+n+1))
-          readmark = TRUE;
+      if (line) {
+        if (line->flags & HBB_PREFIX_READMARK) {
+          // If this is not the last line, we'll display a mark
+          if (n+1 < CHAT_WIN_HEIGHT && *(lines+n+1)) {
+            readmark = TRUE;
+            skipline = TRUE;
+            mark_offset = -1;
+          }
+        }
+      } else if (readmark) {
+        // There will be empty lines, so we don't need to skip the first line
+        skipline = FALSE;
+        mark_offset = 0;
       }
     }
   }
 
-  // Skip first line if there's a mark
-  if (readmark) {
-    skipline = TRUE;
-    mark_offset = -1;
-  }
-
   // Display the lines
   for (n = 0 ; n < CHAT_WIN_HEIGHT; n++) {
     int winy = n + mark_offset;
@@ -1472,7 +1475,7 @@
     if (win_entry->bd->lock)
       setmsgflg = TRUE;
     // If this is an outgoing message, update readmark
-    if (!special && (prefix_flags & HBB_PREFIX_OUT))
+    if (!special && (prefix_flags & (HBB_PREFIX_OUT|HBB_PREFIX_HLIGHT_OUT)))
       hbuf_set_readmark(win_entry->bd->hbuf, FALSE);
     // Show and refresh the window
     top_panel(win_entry->panel);