# HG changeset patch # User Mikael Berthe # Date 1141928731 -3600 # Node ID c502bfe67c316e856f34a7c8ab037c0e53a0eda7 # Parent ab623c2df9648e3c3f38abb6a9fc9c7b5b608fd2 Fix highlighting of outgoing multi-line messages diff -r ab623c2df964 -r c502bfe67c31 mcabber/src/hbuf.c --- a/mcabber/src/hbuf.c Thu Mar 09 18:06:02 2006 +0100 +++ b/mcabber/src/hbuf.c Thu Mar 09 19:25:31 2006 +0100 @@ -250,12 +250,19 @@ unsigned int i; hbuf_block *blk; guchar last_persist_prefixflags = 0; - GList *last_persist; + GList *last_persist; // last persistent flags + // To be able to correctly highlight multi-line messages, + // we need to look at the last non-null prefix, which should be the first + // line of the message. last_persist = hbuf_previous_persistent(hbuf); - if (last_persist && last_persist != hbuf) { - blk = (hbuf_block*)(last_persist->data); - last_persist_prefixflags = blk->prefix.flags; + while (last_persist) { + blk = (hbuf_block*)last_persist->data; + if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) { + last_persist_prefixflags = blk->prefix.flags; + break; + } + last_persist = g_list_previous(last_persist); } hbb_line **array = g_new0(hbb_line*, n); @@ -271,7 +278,7 @@ (*array_elt)->flags = blk->prefix.flags; (*array_elt)->text = g_strndup(blk->ptr, maxlen); - if (blk->flags & HBB_FLAG_PERSISTENT) { + if ((blk->flags & HBB_FLAG_PERSISTENT) && blk->prefix.flags) { last_persist_prefixflags = blk->prefix.flags; } else { // Propagate hilighting flag