After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691266 - gtk_text_iter_forward_to_tag_toggle behaves not as described in documentation
gtk_text_iter_forward_to_tag_toggle behaves not as described in documentation
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 537228 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-01-07 02:40 UTC by Vladimir Rutsky
Modified: 2013-06-20 18:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Program demonstrating bug (1.04 KB, text/x-csrc)
2013-01-07 02:40 UTC, Vladimir Rutsky
  Details
Fix gtk_text_iter_forward_to_tag_toggle() for end iter (993 bytes, patch)
2013-04-03 11:56 UTC, Sébastien Wilmet
needs-work Details | Review
Fix gtk_text_iter_forward_to_tag_toggle() for end iter (3.60 KB, patch)
2013-04-06 13:55 UTC, Sébastien Wilmet
committed Details | Review

Description Vladimir Rutsky 2013-01-07 02:40:41 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.
Comment 1 Sébastien Wilmet 2013-04-03 11:56:17 UTC
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.
Comment 2 Owen Taylor 2013-04-05 21:51:58 UTC
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?
Comment 3 Sébastien Wilmet 2013-04-06 13:55:09 UTC
(In reply to comment #2)
> However, can you add a check into tests/testiter.c for this?

Sure, I'll update the patch.
Comment 4 Sébastien Wilmet 2013-04-06 13:55:56 UTC
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().
Comment 5 Sébastien Wilmet 2013-04-10 16:55:10 UTC
*** Bug 537228 has been marked as a duplicate of this bug. ***
Comment 6 Owen Taylor 2013-06-20 18:20:41 UTC
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 7 Sébastien Wilmet 2013-06-20 18:24:10 UTC
Comment on attachment 240839 [details] [review]
Fix gtk_text_iter_forward_to_tag_toggle() for end iter

Pushed, thanks for the review.