[meld] Workaround for line numbers covering issue (closes bgo#610376)



commit 0ab1773ea74befb28ef93ad9f1a7c24c68f049c0
Author: Piotr Piastucki <the_leech users berlios de>
Date:   Sat Feb 19 12:12:58 2011 +0100

    Workaround for line numbers covering issue (closes bgo#610376)
    
    Both meld and gtksourceviewgutter handle expose-event to draw gutter
    content, however, gtksourceviewgutter handler gets invoked first.
    There seems to be no way to change the order of GTK signal handlers,
    so another expose-event is emitted again after diff coloured block is
    drawn to trigger gtksourceviewgutter handler.

 meld/filediff.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index f053218..64b335f 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -230,6 +230,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.linediffer = self.differ()
         self.linediffer.ignore_blanks = self.prefs.ignore_blank_lines
         self.in_nested_action = False
+        self.in_nested_textview_gutter_expose = False
         self._inline_cache = set()
         self._cached_match = CachedSequenceMatcher()
         for buf in self.textbuffer:
@@ -1085,6 +1086,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         if event.window != textview.get_window(gtk.TEXT_WINDOW_TEXT) \
             and event.window != textview.get_window(gtk.TEXT_WINDOW_LEFT):
             return
+
+        # Hack to redraw the line number gutter used by post-2.10 GtkSourceView
+        if event.window == textview.get_window(gtk.TEXT_WINDOW_LEFT) and \
+           self.in_nested_textview_gutter_expose:
+            self.in_nested_textview_gutter_expose = False
+            return
+
         visible = textview.get_visible_rect()
         pane = self.textview.index(textview)
         area = event.area
@@ -1121,6 +1129,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             context.rectangle(0, ypos - visible.y, width, line_height)
             context.fill()
 
+        if event.window == textview.get_window(gtk.TEXT_WINDOW_LEFT):
+            self.in_nested_textview_gutter_expose = True
+            textview.emit("expose-event", event)
+
     def _get_filename_for_saving(self, title ):
         dialog = gtk.FileChooserDialog(title,
             parent=self.widget.get_toplevel(),



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