textiter: fix bug in _gtk_text_btree_get_iter_at_last_toggle()

If the last tag toggle is the end iter, the function returned the wrong
tag toggle.

This resulted in some bugs where the view wasn't relayout/redrawn
correctly.

The function also always returned TRUE, probably because the return
value is used nowhere. But for consistency with
_gtk_text_btree_get_iter_at_first_toggle(), it's better to keep the
return value, and also because otherwise the function would be wrong (it
doesn't always return a tag toggle, if there is none).

https://bugzilla.gnome.org/show_bug.cgi?id=755413
This commit is contained in:
Sébastien Wilmet 2015-09-22 14:40:57 +02:00 committed by Sébastien Wilmet
parent d8856f1b61
commit b23eabbd64

View File

@ -5648,14 +5648,21 @@ _gtk_text_btree_get_iter_at_last_toggle (GtkTextBTree *tree,
GtkTextIter *iter,
GtkTextTag *tag)
{
gboolean found;
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (tree != NULL, FALSE);
_gtk_text_btree_get_end_iter (tree, iter);
gtk_text_iter_backward_to_tag_toggle (iter, tag);
if (gtk_text_iter_toggles_tag (iter, tag))
found = TRUE;
else
found = gtk_text_iter_backward_to_tag_toggle (iter, tag);
check_invariants (iter);
return TRUE;
return found;
}
gboolean