Hi all,I try to use GtkSourceView for highlighting the "quote levels" in an email message using two different colours. Usually, a MUA inserts a ">" at the beginning of the line to mark it as quoted. If a quoted message gets quoted again, ">" chars accumulate at the beginning of each line, depending upon the mua used sometimes separated by spaces.
I use the following code snipplet to add a GtkTextTag for "Quote-1" (k == 1) to "Quote-9" (k == 9) to a GtkSourceTagTable:
<snip> tag_id = g_strdup_printf("Quote-%d", k); if (k == 1) pattern = g_strdup("^> ?($|[^|>:}#])"); else pattern = g_strdup_printf("^(> ?){%d}($|[^|>:}#])", k); text_tag = gtk_line_comment_tag_new(tag_id, tag_id, pattern); </snip>The re's contain other chars for higher quote levels, as other mua's may use them. As the resulting code shall be used in a mua's composer which *always* inserts ">", they should be fine.
I attach a screenshot to illustrate the result GtkSourceView produces. As you can see, the re mechanism apparently fails for /some/ cases. However, I cannot see that the re's are incorrect. Any idea what went wrong here, and how I could achieve a correct behaviour?
Tia, Cheers, Albrecht. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Albrecht Dreß - Johanna-Kirchner-Straße 13 - D-53123 Bonn (Germany) Phone (+49) 228 6199571 - mailto:albrecht dress arcor de GnuPG public key: http://www.mynetcologne.de/~nc-dreszal/pubkey.asc _________________________________________________________________________
Attachment:
pgpvTiG9GfQx2.pgp
Description: PGP signature