# HG changeset patch # User Tim Ringenbach # Date 1112972218 0 # Node ID 096c8a65d3fc8ffc7a14725e77d508a7cf24484d # Parent d34054fcab501d65627e7d72cf1b82205afc91cc [gaim-migrate @ 12438] ok, I hope this fixes the looping problems. committer: Tailor Script diff -r d34054fcab50 -r 096c8a65d3fc src/gtkimhtml.c --- a/src/gtkimhtml.c Fri Apr 08 01:34:46 2005 +0000 +++ b/src/gtkimhtml.c Fri Apr 08 14:56:58 2005 +0000 @@ -529,7 +529,6 @@ { GtkTextIter start, end, cur; int buf_x, buf_y; - GSList *tags, *l; GdkRectangle visible_rect; GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); GdkColor gcolor; @@ -577,7 +576,8 @@ cur = start; while (gtk_text_iter_in_range(&cur, &start, &end)) { - tags = gtk_text_iter_get_tags(&cur); + GSList *tags = gtk_text_iter_get_tags(&cur); + GSList *l; gaim_debug_info("gtkimhtml", "cur = %d, start = %d, end = %d\n", gtk_text_iter_get_offset(&cur), gtk_text_iter_get_offset(&start), @@ -605,8 +605,10 @@ rect.x = visible_rect.x; rect.y = tag_area.y; - while (!gtk_text_iter_is_end(&cur) && gtk_text_iter_begins_tag(&cur, tag)) + do gtk_text_iter_forward_to_tag_toggle(&cur, tag); + while (!gtk_text_iter_is_end(&cur) && gtk_text_iter_begins_tag(&cur, tag)); + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &cur, &tag_area); gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, @@ -634,14 +636,20 @@ rect.x, rect.y, rect.width, rect.height); gaim_debug_info("gtkimhtml", "drawing rect at %d,%d to %d,%d\n", rect.x, rect.y, rect.x+rect.width, rect.y+rect.height); - gtk_text_iter_backward_char(&cur); + gtk_text_iter_backward_char(&cur); /* go back one, in case the end is the begining is the end + * note that above, we always moved cur ahead by at least + * one character */ break; } g_slist_free(tags); - while (gtk_text_iter_forward_to_tag_toggle(&cur, NULL) && gtk_text_iter_begins_tag(&cur, NULL)); - } - + + /* loop until another tag begins, or no tag begins */ + while (gtk_text_iter_forward_to_tag_toggle(&cur, NULL) && + !gtk_text_iter_is_end(&cur) && + !gtk_text_iter_begins_tag(&cur, NULL)); + } + gdk_gc_unref(gc); if (GTK_WIDGET_CLASS (parent_class)->expose_event)