GtkSourceView: highlighting problems
Albrecht Dreß <[email protected]>
| Newsgroups | gmane.comp.gnome.devtools |
|---|---|
| Message-ID | <[email protected]> |
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:[email protected]
GnuPG public key: http://www.mynetcologne.de/~nc-dreszal/pubkey.asc
_________________________________________________________________________
_______________________________________________
gnome-devtools mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-devtools
Bildschirmfoto-3.png
(image/png, 20.8 KB) - not displayed
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBD5jJ7n/9unNAn/9ERAhoWAKC7/F2hhXa6B90b3y7W7JSqrCijTgCgt+XN o5RC1CgcZXSgYks31NFrPjc= =2ebg -----END PGP SIGNATURE-----