GNOME Bugzilla – Bug 691266
gtk_text_iter_forward_to_tag_toggle behaves not as described in documentation
Last modified: 2013-06-20 18:24:22 UTC
Created attachment 232891 [details] Program demonstrating bug Documentation for gtk_text_iter_forward_to_tag_toggle says: If no matching tag toggles are found, returns FALSE, otherwise TRUE. Does not return toggles located at iter, only toggles after iter. But if you call gtk_text_iter_forward_to_tag_toggle(<end>, NULL) at buffer end where some tag ends it will return TRUE. Please see attached example for details.
Created attachment 240471 [details] [review] Fix gtk_text_iter_forward_to_tag_toggle() for end iter The function must return TRUE only if there is a tag toggle _after_ the iter, not _at_ the iter. So for the end iter, the function must always return FALSE.
Review of attachment 240471 [details] [review]: This definitely should work. (Alternate patch would be to have a 'gboolean moved' and do 'if (moved && gtk_text_iter_toggles_tag (iter, tag))', but on consideration, that's just different, not better.) However, can you add a check into tests/testiter.c for this?
(In reply to comment #2) > However, can you add a check into tests/testiter.c for this? Sure, I'll update the patch.
Created attachment 240839 [details] [review] Fix gtk_text_iter_forward_to_tag_toggle() for end iter The function must return TRUE only if there is a tag toggle _after_ the iter, not _at_ the iter. So for the end iter, the function must always return FALSE. Add also unit tests for gtk_text_iter_forward_to_tag_toggle().
*** Bug 537228 has been marked as a duplicate of this bug. ***
Review of attachment 240839 [details] [review]: Looks good to me. Please commit to master *only* and not to the 3.8 branch - this is basically an API addition (the new API being not having to work around the return value of forward_to_tag_toggle())
Comment on attachment 240839 [details] [review] Fix gtk_text_iter_forward_to_tag_toggle() for end iter Pushed, thanks for the review.