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 777587 - Gutter pixbuf renderer handles LAST alignment incorrectly
Gutter pixbuf renderer handles LAST alignment incorrectly
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
3.22.x
Other Linux
: Normal minor
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-21 21:18 UTC by Kai Willadsen
Modified: 2017-01-22 12:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1015 bytes, patch)
2017-01-21 21:18 UTC, Kai Willadsen
none Details | Review

Description Kai Willadsen 2017-01-21 21:18:36 UTC
Created attachment 343959 [details] [review]
Patch

When using GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST, the pixbuf should be aligned within the last visual line of the wrapped logical line. However, it's actually aligned within the first line, because the code uses the y-coordinate from the cell instead of from the textview line. The attached patch fixes this for me.

For what it's worth, I'm only noticing this because I'm implementing a gutter renderer that supports matching this alignment, not because I'm using LAST, so this clearly isn't that vital...

Filed against 3.22, because that's where I'm testing it. I've confirmed that this code is the same in master, but not tested the patch there.
Comment 1 Sébastien Wilmet 2017-01-22 09:48:53 UTC
Thanks, I've read the code carefully, and your patch totally makes sense. I've also tested by modifying gtksourcegutterrenderermarks.c, and I was able to reproduce the bug and I confirm that the bug is fixed with the patch.

Pushed as commit b22640343b0d3f260dab45d88e765ba66a3531d3 on master.
And cherry-picked on the gnome-3-24 and gnome-3-22 branches.

Thanks again!
Comment 2 Sébastien Wilmet 2017-01-22 10:20:36 UTC
Ah, I forgot to test one thing: gtk_text_view_get_iter_location() returns the location in buffer coordinates. It works for pixbufs added at the beginning of the buffer, where buffer coords == window coords. But if the buffer contains enough text to have scrollbars, when we are not at the top the pixbuf is not drawn.

Normally it's just a matter of calling gtk_text_view_buffer_to_window_coords(). Can you provide a second patch for this?
Comment 3 Kai Willadsen 2017-01-22 10:26:45 UTC
Argh! Yeah I'll have a poke at that, but probably next weekend. I should have thought to test that, sorry.
Comment 4 Sébastien Wilmet 2017-01-22 12:02:09 UTC
I didn't want to revert the commit, and the fix was simple, so I've fixed it:
commit 686bf1557da39af005a1784ae2762b8fd0d71755.