[meld] gutterrendererchunk: Translate buffer coords for alignment (bgo#777553)



commit 44d14deb014a71bb4bd77cc8b03473c39f6248f6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu Jan 26 08:53:43 2017 +1000

    gutterrendererchunk: Translate buffer coords for alignment (bgo#777553)
    
    When we changed the gutter renderers to handle non-CELL alignment, we
    incorrectly used the locations returned from get_iter_location() for
    painting, which is incorrect; these are buffer coordinates not window
    coordinates.

 meld/gutterrendererchunk.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index de95821..4d64d2f 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -260,9 +260,12 @@ class GutterRendererChunkAction(
                 icon_y = y + (height - pix_height) // 2
             else:
                 line_iter = start if align_mode == ALIGN_MODE_FIRST else end
-                loc = self.get_view().get_iter_location(line_iter)
+                textview = self.get_view()
+                loc = textview.get_iter_location(line_iter)
+                line_x, line_y = textview.buffer_to_window_coords(
+                    self.get_window_type(), loc.x, loc.y)
                 icon_x = cell_area.x + (cell_area.width - pix_width) * xalign
-                icon_y = loc.y + (loc.height - pix_height) * yalign
+                icon_y = line_y + (loc.height - pix_height) * yalign
 
             Gtk.render_icon(style_context, context, pixbuf, icon_x, icon_y)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]