[gtk+] textiter: fix bug in _gtk_text_btree_get_iter_at_last_toggle()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] textiter: fix bug in _gtk_text_btree_get_iter_at_last_toggle()
- Date: Wed, 7 Oct 2015 14:58:13 +0000 (UTC)
commit b23eabbd642a5d4c46a173d5324a76f4cb63c9f7
Author: Sébastien Wilmet <sebastien wilmet uclouvain be>
Date: Tue Sep 22 14:40:57 2015 +0200
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
gtk/gtktextiter.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index c600b83..6b31c64 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]