diff options
author | Sébastien Wilmet <sebastien.wilmet@uclouvain.be> | 2015-09-22 14:40:57 +0200 |
---|---|---|
committer | Sébastien Wilmet <swilmet@gnome.org> | 2015-10-07 16:41:37 +0200 |
commit | b23eabbd642a5d4c46a173d5324a76f4cb63c9f7 (patch) | |
tree | b5c2777cfe2aa37d2aa2e88b979e61b1c5ff82b1 /gtk/gtktextiter.c | |
parent | d8856f1b61caf5bca71070b5a59812fdd33314b9 (diff) | |
download | gtk+-b23eabbd642a5d4c46a173d5324a76f4cb63c9f7.tar.gz |
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
Diffstat (limited to 'gtk/gtktextiter.c')
-rw-r--r-- | gtk/gtktextiter.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index c600b83258..6b31c6485c 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 |