Index: filediff.py
===================================================================
--- filediff.py	(Revision 1032)
+++ filediff.py	(Arbeitskopie)
@@ -1032,13 +1032,10 @@
             self._setup_gcs(area)
 
         gc = area.meldgc.get_gc
-        for c in self.linediffer.single_changes(textindex, self._get_texts()):
+        texts = self._get_texts()
+        for c in self.linediffer.single_changes(textindex, texts):
             assert c[0] != "equal"
-            outline = True
-            if self.prefs.ignore_blank_lines:
-                c1,c2 = self._consume_blank_lines( self._get_texts()[textindex][c[1]:c[2]] )
-                if (c1 or c2) and (c[1]+c1 == c[2]-c2):
-                    outline = False
+            outline = not self._is_ignored(c, texts[textindex], texts[c[5]])
             s,e = [int(x) for x in ( math.floor(scaleit(c[1])), math.ceil(scaleit(c[2]+(c[1]==c[2]))) ) ]
             window.draw_rectangle( gc(c[0]), 1, x0, s, x1, e-s)
             if outline: window.draw_rectangle( gctext, 0, x0, s, x1, e-s)
@@ -1089,25 +1086,26 @@
     def next_diff(self, direction):
         adjs = map( lambda x: x.get_vadjustment(), self.scrolledwindow)
         curline = self._pixel_to_line( 1, int(adjs[1].value + adjs[1].page_size/2) )
-        c = None
+        found = None
+        texts = self._get_texts()
         if direction == gdk.SCROLL_DOWN:
-            for c in self.linediffer.single_changes(1, self._get_texts()):
+            for c in self.linediffer.single_changes(1, texts):
                 assert c[0] != "equal"
-                c1,c2 = self._consume_blank_lines( self._get_texts()[1][c[1]:c[2]] )
-                if c[1]+c1 == c[2]-c2:
+                if self._is_ignored(c, texts[1], texts[c[5]]):
                     continue
                 if c[1] > curline + 1:
+                    found = c
                     break
         else: #direction == gdk.SCROLL_UP
-            for chunk in self.linediffer.single_changes(1, self._get_texts()):
-                c1,c2 = self._consume_blank_lines( self._get_texts()[1][chunk[1]:chunk[2]] )
-                if chunk[1]+c1 == chunk[2]-c2:
+            for c in self.linediffer.single_changes(1, texts):
+                if self._is_ignored(c, texts[1], texts[c[5]]):
                     continue
-                if chunk[2] < curline:
-                    c = chunk
-                elif c:
+                if c[2] < curline:
+                    found = c
+                elif found:
                     break
-        if c:
+        if found:
+            c = found
             if c[2] - c[1]: # no range, use other side
                 l0,l1 = c[1],c[2]
                 aidx = 1
@@ -1133,19 +1131,13 @@
         area.meldgc = misc.struct(gc_delete=gcd, gc_insert=gcd, gc_replace=gcc, gc_conflict=gcx)
         area.meldgc.get_gc = lambda p: getattr(area.meldgc, "gc_"+p)
 
-    def _consume_blank_lines(self, txt):
-        lo, hi = 0, 0
-        for l in txt:
-            if len(l)==0:
-                lo += 1
-            else:
-                break
-        for l in txt[lo:]:
-            if len(l)==0:
-                hi += 1
-            else:
-                break
-        return lo,hi
+    def _is_ignored(self, c, txt1, txt2):
+        if not self.prefs.ignore_blank_lines:
+            return False
+        for line in txt1[c[1]:c[2]] + txt2[c[3]:c[4]]:
+            if line.strip():
+                return False
+        return True
 
         #
         # linkmap drawing
@@ -1189,15 +1181,11 @@
             return [self._pixel_to_line(idx, pix_start[idx]), self._pixel_to_line(idx, pix_start[idx]+htotal)]
         visible = [None] + bounds(which) + bounds(which+1)
 
+        texts = self._get_texts()
+        for c in self.linediffer.pair_changes(which, which+1, texts):
+            if self._is_ignored(c, texts[which], texts[which+1]):
+                continue
 
-        for c in self.linediffer.pair_changes(which, which+1, self._get_texts()):
-            if self.prefs.ignore_blank_lines:
-                c1,c2 = self._consume_blank_lines( self._get_texts()[which  ][c[1]:c[2]] )
-                c3,c4 = self._consume_blank_lines( self._get_texts()[which+1][c[3]:c[4]] )
-                c = c[0], c[1]+c1,c[2]-c2, c[3]+c3,c[4]-c4
-                if c[1]==c[2] and c[3]==c[4]:
-                    continue
-
             assert c[0] != "equal"
             if c[2] < visible[1] and c[4] < visible[3]: # find first visible chunk
                 continue
@@ -1296,13 +1284,10 @@
             adj = self.scrolledwindow[src].get_vadjustment()
             func = lambda c: self._line_to_pixel(src, c[1]) - adj.value
 
-            for c in self.linediffer.pair_changes(src, dst, self._get_texts()):
-                if self.prefs.ignore_blank_lines:
-                    c1,c2 = self._consume_blank_lines( self._get_texts()[src][c[1]:c[2]] )
-                    c3,c4 = self._consume_blank_lines( self._get_texts()[dst][c[3]:c[4]] )
-                    c = c[0], c[1]+c1,c[2]-c2, c[3]+c3,c[4]-c4
-                    if c[1]==c[2] and c[3]==c[4]:
-                        continue
+            texts = self._get_texts()
+            for c in self.linediffer.pair_changes(src, dst, texts):
+                if self._is_ignored(c, texts[src], texts[dst]):
+                    continue
                 if c[0] == "insert":
                     continue
                 h = func(c)
