GNOME Bugzilla – Bug 755413
Bug in _gtk_text_btree_get_iter_at_last_toggle()
Last modified: 2015-10-07 15:00:16 UTC
There is a bug in _gtk_text_btree_get_iter_at_last_toggle() when the last tag toggle is the end iter. A patch will be attached, it was easy to fix. Due to this bug, there is some relayout/redrawing problems in GtkTextView when a tag property changes.
Created attachment 311857 [details] [review] 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).
Note: writing a unit test for the function is not directly possible in testsuite/gtk/textiter.c because the function is private.
(it seems that git-bz didn't add the bug url for me, so I added it myself locally)
Review of attachment 311857 [details] [review]: Looks right to me. But why has this never shown up as problem before ? Shouldn't there be some misrendering somewhere that you can trigger with a testcase ?
Created attachment 312009 [details] test case Test case that triggers the bug. The drawing bug happens if: 1. a tag property changes 2. the tag property must affect the size of the text (so that size_changed=TRUE in the tag-changed signal) 3. the tag spans multiple lines at the end of the buffer Those three combined conditions are quite rare, except when writing a test program. And anyway if we click in the text view after changing the property, it redraws correctly.
Comment on attachment 311857 [details] [review] textiter: fix bug in _gtk_text_btree_get_iter_at_last_toggle() I've pushed the commit, a test case was attached and the fix is quite trivial.