[meld] filediff: Work around an inline highlighting issue using cached results



commit 10ea9819561aa9a3c4651bec9979299752ffc2e8
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Mar 8 09:46:41 2014 +1000

    filediff: Work around an inline highlighting issue using cached results
    
    This is extremely weird, and I can't figure out what's going on. If the
    tags are applied in an idle handler, then we're fine. If they're
    applied directly then they don't show up. The inner logic of the
    apply_highlighting() callback looks to be identical in all cases, but
    obviously something is awry.

 meld/filediff.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 9bbbe17..4fc5f99 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -77,7 +77,10 @@ class CachedSequenceMatcher(object):
     def match(self, text1, textn, cb):
         try:
             self.cache[(text1, textn)][1] = time.time()
-            cb(self.cache[(text1, textn)][0])
+            # FIXME: This idle should be totally unnecessary, and yet nothing
+            # gets highlighted without it, even though everything in the
+            # callback appears to run identically.
+            GLib.idle_add(lambda: cb(self.cache[(text1, textn)][0]))
         except KeyError:
             def inline_cb(opcodes):
                 self.cache[(text1, textn)] = [opcodes, time.time()]


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